Question: Write a program to store water usage data of 4 customers in a text file. The program asks the user to enter account number, customer
Write a program to store water usage data of 4 customers in a text file. The program asks the user to enter account number, customer type (R for residential or B for business), and number of gallons used for each of the 4 customers. Store the data in a text file named water.txt. Overwrite old data in water.txt if the file already exists. The following is an example.
Enter account number: 3147
Enter R for residential, B for business: R
Enter number of gallons used: 1000
Enter account number: 2168
Enter R for residential, B for business: R
Enter number of gallons used: 6002
Enter account number: 5984
Enter R for residential, B for business: B
Enter number of gallons used: 2000
Enter account number: 7086
Enter R for residential, B for business: B
Enter number of gallons used: 8002
The example above writes the following data to the file water.txt:
3147 R 1000
2168 R 6002
5984 B 2000
7086 B 8002
Please answer with code i can use with pycharm for python programming
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
