about | help | code help+videos | done | prefs |
differ
Write a function differ(data1, data2) that returns the first index at which the two lists data1 and data2 differ. If the two lists are the same, your function should return -1. You may assume that the lists have the same length. For example, differ([’CS’, ’rules’, ’!’], [’CS’, ’totally’, ’rules!’]) should return the index 1. differ([1, 2, 3, 4, 5], [1, 2, 4, 8, 16]) → 2 differ([1, 2, 3, 4, 5], [1, 2, 3, 4, 5]) → -1 differ(['a', 'c', 'b', 'that', 'thing'], ['a', 'that', 'b', 'c', 'thing']) → 1 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Copyright Nick Parlante 2017 - privacy