Kodewick
Start learning →
Starter←→0 / 80

Thirsty plants

#033StarterDictsLoops3 min

The balcony plants are kept in a dict: {plant: days since watered}. Write thirsty_plants(days) to return the plants that have gone 3 days or more without water, in the dict's order. If none need water, return [].

Examples
thirsty_plants({"fern": 4, "cactus": 10, "mint": 1})→['fern', 'cactus']
thirsty_plants({})→[]
main.py
def thirsty_plants(days):
    thirsty = []
    # your code here: loop over items() and add the plant to thirsty when its days are 3 or more
    return thirsty
Ctrl + Enter runs too
Result

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