Question: Python Help read & writing to csv Invoice with CSV DUE Monday 11/12 Script name: invoiceConfiguration.py A small video game retail store would like to
Python Help read & writing to csv
Invoice with CSV DUE Monday 11/12
Script name: invoiceConfiguration.py
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 customer's name and then for the number of items sold for that item. For example, if the user selects 2, make the following prompt:
Customer's Name: How many PUBG copies sold:
Your script should keep track of every transaction by logging all the transaction's date, the customer's name, the product sold, the number of copies, and the cost (price x number of copies).
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.csv. All file output should be comma separated.
Date, Customer_Name, Product_Name, Copies_Sold, Sale_Price
invoice_data.csv should not contain duplicated item data.
Handle the case where invoice_data.csv may not exist. If the file does not exist, default all copies sold to zero.
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.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
