Kodewick
Start learning →
Starter←→0 / 100

Is the toy in stock?

#047StarterLists2 min

The toy shop keeps a list of what is on the shelf. When a child asks for a toy, in_stock(shelf, toy) should return True if toy is on the list and False if not. The name must match exactly.

Examples
in_stock(["yo-yo", "kite", "robot"], "kite")→True
in_stock(["yo-yo", "kite"], "puzzle")→False
main.py
def in_stock(shelf, toy):
    # your code here: is toy in shelf?
    return False
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.