Fix the 5 errors in the code below so that it runs and prints
the largest PM 2.5 value and the city that has that value.
Save & Run Load History 1 inFile = open("uspoll.txt","r" 2 lines = inFile.readlines() 3 inFile.Close() 4 5 maxCity 6 max 25 = # initialize max25 7 for line lines: 8 values = line.split(":") 9 new25 = float(values[2]) # get the current value if new25 > max25 maxCity = values[0] max25 = new25 # save the new maximum 13 print("Largest PM 2.5 value is ", max25," in ", maxCity) 10 11 12 14
Fix the 5 errors in the code below so that it runs and prints the largest PM 2.5 value and the city that has that value.
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Fix the 5 errors in the code below so that it runs and prints the largest PM 2.5 value and the city that has that value.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!