mercredi 7 février 2018

program to look up price in dictionnary

I am having issues with creating this program I don't know whether I should use elif or something else. it's very urgent please help !!!

here is the question: In the cell below, use the try/except control structure to create a program which looks up a price in a dictionary.

shop_prices = { 'eggs': 1.99, 'milk': 0.99, 'ham': 4.99, }

take two inputs - what the customer wants, and how many of the items they want

always greet the customer

see if they sell the item and calculate the price

otherwise say "We don't sell XXX", where XXX is the item

always say goodbye to the customer

Aucun commentaire:

Enregistrer un commentaire