← Back to challenges

Where is Bob!?!

PythonHarddata_structureslanguage_fundamentalsarrays

Instructions

Write a function that searches a list of names (unsorted) for the name "Bob" and returns the location in the list. If Bob is not in the list, return -1.

Examples

find_bob(["Jimmy", "Layla", "Bob"]) ➞ 2

find_bob(["Bob", "Layla", "Kaitlyn", "Patricia"]) ➞ 0

find_bob(["Jimmy", "Layla", "James"]) ➞ -1

Notes

Assume all names start with a capital letter and are lowercase thereafter (i.e. don't worry about finding "BOB" or "bob").

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Fix the Spacing