id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

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(['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)

def differ(data1, data2):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Copyright Nick Parlante 2017 - privacy