Question: Write a program to calculate and print out the total amount payed in a coffeeshop. The bill is stored in a file bill.txt where each

 Write a program to calculate and print out the total amountpayed in a coffeeshop. The bill is stored in a file bill.txt

Write a program to calculate and print out the total amount payed in a coffeeshop. The bill is stored in a file bill.txt where each line contains the purchased item and its prices as follows: Coffe 1.500 Muffin 1.700 Orange Juice 0.330 The expected output is: Total: 3.53 Assume that we are not using the split method in this program. Assume that we are not using the split method in this program. To answer the question, drag and drop the statements (below) to their correct position in the code (above). for line in infile: price = line[0:1] total+=price while not line[i].isdigit(): price = float(line[i: 1) while line[i].isdigit(): print("Total:%6.2f"%total) | infile = open("bill.txt", 'W') i=i+1 price = line[0:- 1] infile = open("bill.txt", 'r') i=0 total = 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!