mercredi 16 juin 2021

Can you help me with this ques as i didnt know how to get a single element from a dict in python

Taking a Python dictionary called shop_items, and a single value called, target_item, as arguments.

Example:
shop_items = {'Orange':5, 'Apple':6, 'Milk': 1, 'Towel': 2}
target_item = 'Tomato'

Write a Python function, find_target(shop_item, targetItem), which return a True value if the target item exists in shop_items, otherwise returns a False

Aucun commentaire:

Enregistrer un commentaire