Question: Please do explain that how will we return the sorted rainfall Exercise 2: Student's Choice (solve either Exercise 2A or 2B) Exercise 2A: Create a
Exercise 2: Student's Choice (solve either Exercise 2A or 2B) Exercise 2A: Create a Python program that reads the data stored in the provided rainfall.txt, where each line in the text file contains the name of a city, followed by whitespace, followed by the city's annual rainfall (in mm). Process this data so that it is grouped by annual rainfall into the following categories: [50-60 mm), [60-70 mm), [70-80 mm), (80-90 mm), [90-100 mm), and then sorted from lowest to highest rainfall within each category. Write this processed data to a new file called rainfallfmt.txt, so that under each category the city name is centered in a field that is 25 characters wide and is in all uppercase letters. The city name should be followed by its rainfall, right-aligned in a field that is 5 characters wide with 1 digit to the right of the decimal point. Exercise 2A: Sample Output: [50-60 mm) [60-70 mm) AKRON 65.6 ALTON 69.7 [70-80 mm) ALGONA 78.0 [80-90 mm) BRITT 80.1 CARROLL 84.7 ANKENY 84.8
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
