In this lab you will be presented with a menu ordering system which will allow users to
input three choices for a select menu. You are tasked with completing the menu system so
that it returns and calculates the final bill for the user.
- View -> Editor Layout -> Two Columns
- To view this file in Preview mode, right click on this README.md file and
Open Preview
- Select your code file in the code tree, which will open it up in a new VSCode tab.
- Drag your assessment code files over to the second column.
- Great work! You can now see instructions and code at the same time.
- Select your Python file in the Visual Studio Code file tree
- You can right click the file and select "Run Python File in Terminal" or run the file using the smaller
play button in the upper right-hand corner of VSCode.
(Select "Run Python File in Terminal" in the provided button dropdown)- Alternatively, you can follow lab instructions which use python3 commands to run your code in terminal.
- Create new functions to solve specific problems.
- Gain experience of using for loops to iterate over different data collections.
- Create and use data structures to store, retrieve and loop over data.
-
Open the script ordering_system.py present inside the project folder.
-
Run the script and, when requested, enter in the three products of your choice based on the menu - 1 = espresso, 2 = coffee etc.
-
To run the script, open terminal and execute the following command.
python3 ordering_system.py
-
Extend the script to have a new function called
calculate_subtotal
.
It should accept one argument which is the order list and return the sum
of the prices of the items in the order list. -
Implement
calculate_tax()
which calculates the tax of the subtotal.
The tax percentage is 15% of overall bill. -
Implement
summarize_order()
which returns a list of the names of the items
that the customer ordered and the total amount (including tax) that they have to pay.
The orders should show the name and price.