Turn the following code into a procedure. Pass the input file and the amount of PM 10 to the procedure. It will print th
Posted: Fri May 20, 2022 5:26 pm
Turn the following code into a procedure. Pass the input file
and the amount of PM 10 to the procedure. It will print the city
name and the pollution values for all cities that have that much PM
10 pollution or more.
Save & Run Load History 4 5 = 6 1 inFile = open("uspoll.txt","r") 2 line = infile.readline() 3 while line: values = line.split(":") pollution = float(values[1]) if (pollution > 25): print('City: ', values[0]) print("Pollution values:", values[1],values[2]) 9 line = inFile.readline() 10 11 inFile.close() 12 7 8
and the amount of PM 10 to the procedure. It will print the city
name and the pollution values for all cities that have that much PM
10 pollution or more.
Save & Run Load History 4 5 = 6 1 inFile = open("uspoll.txt","r") 2 line = infile.readline() 3 while line: values = line.split(":") pollution = float(values[1]) if (pollution > 25): print('City: ', values[0]) print("Pollution values:", values[1],values[2]) 9 line = inFile.readline() 10 11 inFile.close() 12 7 8