Kodewick
Start learning →
Starter←→0 / 80

Ages next year

#013StarterComprehensionsLists3 min

The after-school club's list has each kid's age this year. Write next_year(ages) to return everyone's age next year with one list comprehension, in the same order. An empty list gives an empty list.

Examples
next_year([7, 8, 7])→[8, 9, 8]
next_year([])→[]
main.py
def next_year(ages):
    # your code here: a list comprehension that turns each a into a + 1
    return []
Ctrl + Enter runs too
Result

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