Question
PLEASE PYTHON ONLY!!!!!! AND PLEASE DO NOT PRESENT ADVANCED SOLUTIONS!! THIS IS JUST AN INTRODUCTORY PYTHON COURSE Lab Objectives: Strings, Files, Modules Notes: You should
PLEASE PYTHON ONLY!!!!!!
AND PLEASE DO NOT PRESENT ADVANCED SOLUTIONS!! THIS IS JUST AN INTRODUCTORY PYTHON COURSE
Lab Objectives: Strings, Files, Modules
Notes:
- You should only use functionality in your solution.
- Your solution for this should not use lists, tuples, dictionaries.
- Do NOT use the string split() function.
- Include a docstring for your functions.
- Download the files orders.txt, customers.txt.
- Create a module, order.py that contains the following functions:
- find_order(): takes a string file name and a customer name as parameters. Returns the order id of the customer with the given name. If no customer is found, returns -1. The customer name is not case sensitive.
- find_order_items(): takes a file name and an order id as parameters. Returns the total cost, and string set of items for the order with the given id. If the order id is not in the file, total cost will be zero and the (string) set of items will be an empty string.
- Write a script, yourname_order_app.py that inputs the name of a customer from the user. Using functionality defined in the module, your program should display the items ordered by the customer and the total cost of the order. If customer/order is not found, display a meaningful message (see sample run below). Append the customer name and total cost to a file with the name
.txt . The program should keep inputting customer names and searching orders until the user inputs exit to quit (not case sensitive). - Upload order.py and yourname_order_app.py in a zip file with the name: Lab04_yourname.zip.
Sample Runs:
Enter customer name to search(exit to quit): Anna Karpat
Order Summary:
pinar organic milk
uno whole wheat bread
chicken wings
Barilla Spaghetti
Total Order Price: 43.8
Enter customer name to search(exit to quit): Sara Glen
Customer Not Found!
Enter customer name to search(exit to quit): Selina Roberts
Order Not Found!
Enter customer name to search(exit to quit): MERT EREN
Order Summary:
broccoli
uno lavas
ground beef
Total Order Price: 74.85000000000001
Enter customer name to search(exit to quit): exit
orders (1) - Not Defteri Dosya Dzen Biim Grnm Yardm 12345; pinar organic milk;8.95 12345; uno whole wheat bread; 9.95 98734; broccoli;4.65 34567; dimes orange juice;6.50 98734; uno lavas; 8.25 12345; chicken wings; 18.95 98734; ground beef,61.95 34567; keskinoglu eggs; 18.95 12345; Barilla Spaghetti;5.95 customers (1) - Not Defteri Dosya Dzen Biim Grnm Yardm 89454, Kaan Kolay 12345, Anna Karpat 20987, Selina Roberts 98734, Mert Eren 45678, Alara Yetis orders (1) - Not Defteri Dosya Dzen Biim Grnm Yardm 12345; pinar organic milk;8.95 12345; uno whole wheat bread; 9.95 98734; broccoli;4.65 34567; dimes orange juice;6.50 98734; uno lavas; 8.25 12345; chicken wings; 18.95 98734; ground beef,61.95 34567; keskinoglu eggs; 18.95 12345; Barilla Spaghetti;5.95 customers (1) - Not Defteri Dosya Dzen Biim Grnm Yardm 89454, Kaan Kolay 12345, Anna Karpat 20987, Selina Roberts 98734, Mert Eren 45678, Alara YetisStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started