about | help | code help+videos | done | prefs |
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(['a', 'list', 'of', 'words', 'to', 'test', 'the', 'function'], ['a', 'list', 'of', 'words', 'to', 'test', 'some', 'function']) → 6 differ(['a', 'list', 'of', 'words', 'to', 'test', 'the', 'function'], ['a', 'list', 'of', 'words', 'to', 'test', 'the', 'Function']) → 7 differ(['she', 'sells', 'sea', 'shells', 'on', 'the', 'sea', 'shore'], ['she', 'sells', 'sea', 'shells', 'on', 'the', 'sea', 'shore']) → -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