Question: Python Script name: invoice.py. (Please type your answer) A small video game retail store would like to automate their invoicing to keep track of product
Python Script name: invoice.py. (Please type your answer)
A small video game retail store would like to automate their invoicing to keep track of product sales, how much they have made for each type of item, and the total amount of money made for all items. Create a script that performs a persistent invoice for products.
Prompt the user to select from the main menu below:
1. Fortnite ($29.99) 2. PUBG ($19.99) 3. Candy Crush ($4.99) 4. Print Invoice 5. Exit Your choice:
If the user enters 1-3, ask the user for the number of items sold for that item. For example, if the user selects 2, make the following prompt:
How many PUBG copies sold:
Your script should keep track of every item sold by adding the number of copies the user enters in the prompt above to the number of copies previously sold.
When the user enters in 4 from the main menu, the script should print the number of copies sold for each item, the amount of money made for each item's sales, and the amount of money made for all items together. These calculations should factor in data previously entered from past executions of your script. For example:
Fortnite: Copies sold: 3 Amount made: $89.97 PUBG: Copies sold: 2 Amount made: $39.98 Candy Crush: Copies sold: 0 Amount made: $0 Total: $129.95
The program should continuously prompt the user for input until the user selects 5 from the main menu to exit.
Requirements:
Save sales data to invoice_data.txt.
invoice_data.txt should not contain duplicated item data.
Handle the case where invoice_data.txt may not exist.
Use at least one list, one function, and one loop.
Do not add any additional prompts and output. Only follow what is required.
Comment your code.
Code that generates an error or does not compile will receive a maximum of 10 points.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
