Workout #14: Restaurant

Sep 28, 2021

In this exercise, create a new constant dict, called MENU, representing the possible items you can order at a restaurant. The keys will be strings, and the values will be prices (i.e., integers). You should then write a function, restaurant, that asks the user to enter an order:

  • If the user enters the name of a dish on the menu, the program prints the price and the running total. It then asks the user again for their order.
  • If the user enters the name of a dish not on the menu, the program scolds the user (mildly). It then asks the user again for their order.
  • If the user enters an empty string, the program stops prompting and prints the total amount.

TRY IT YOURSELF

ANSWER

https://colab.research.google.com/drive/1J8ZXF0N4IdojYTRoEMuLjE1bM7UUhhzq?usp=sharing

--

--

Abish Pius
Abish Pius

Written by Abish Pius

Data Science Professional, Python Enthusiast, turned LLM Engineer

No responses yet