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

 

indexOf


Complete the function so that it returns the index of the first occurrence of x in the list. If x is NOT in the list, then the function should return a -1.


indexOf([6, 12, 7, 2, 7], 7) → 2
indexOf([7, 2, 8], 5) → -1
indexOf([4, 4, 4, 4], 4) → 0

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

def indexOf( nums, x ):

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

Difficulty: 200

Copyright Nick Parlante 2017 - privacy