Respuesta :
Answer:
with open('water.txt','w') as file:
i = 4
while i > 0:
accNo = input('Enter Account Number: ')
bType = input('Enter Customer Type R or B: ')
nGallons = input('Enter Number of gallons: ')
ls = ' '.join(['Account Number:', accNo,'\nType:', bType, '\nNumber Of gallons:',nGallons,'\n\n'])
file.write(ls)
i -= 1
Explanation:
The programming language used is python.
A file water.txt is created, and a counter is initialized to ensure data is collected for all the the customers.
A loop is created to collect the input of the four customers. The data is collected, assigned to a list and joined using the join method, to create a string of the data collected and it is written to the file.
Using a WITH statement allows a file to automatically close.