Kodewick
Start learning →
Starter←→0 / 80

Share the cookies

#048StarterErrorsNumbers3 min

A plate of cookies is shared out between the kids, whole cookies only, leftovers stay on the plate. Write cookies_each(cookies, kids) to return how many each kid gets. If no kids came (kids is 0), return 0.

Examples
cookies_each(12, 4)→3
cookies_each(7, 0)→0
main.py
def cookies_each(cookies, kids):
    try:
        # your code here: work out cookies each with // and return it
        pass
    except ZeroDivisionError:
        return 0
Ctrl + Enter runs too
Result

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