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

 

konstans@stuy.edu > foundFirst
prev  |  next  |  chance

Given a list and two values, find the first occurrence of each value. Return the lower index of the two locations. If one of the values is not in the list, use the other value. When neither value is in the list return -1.


foundFirst([], 1, 2) → -1
foundFirst([1, 3, 4, 2], 1, 2) → 0
foundFirst([2, 3, 4, 1], 1, 3) → 1

...Save, Compile, Run (ctrl-enter)

def foundFirst(data,x,y):

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