Kodewick
Start learning →
Starter←→0 / 100

Items in the cart

#045StarterLists2 min

The online shop shows a little number on the cart icon. Write cart_size(cart) to return how many things are in the cart list. An empty cart gives 0.

Examples
cart_size(["socks", "mug", "pen"])→3
cart_size([])→0
main.py
def cart_size(cart):
    # your code here: how long the list is
    return 0
Ctrl + Enter runs too
Result

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