Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please do give a detailed explanation of the code Exercise 2A: Create a Python program that reads the data stored in the provided rainfall.txt, where

Please do give a detailed explanation of the code
image text in transcribed
image text in transcribed
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. 65.6 69.7 Exercise 2A: Sample Output: [50-60 mm) [60-70 mm) AKRON ALTON [70-80 mm) ALGONA [80-90 mm) BRITT CARROLL ANKENY 78.0 80.1 84.7 84.8 Done rainfall Akron 65.5574 Albia 95.631 Algona 77.9526 Allison 85.4456 Alton 69.6722 AmesW 86.5378 AmesSE 86.233 Anamosa 89.7382 Ankeny 84.7852 Atlantic 88.3158 Audubon 84.8614 Beaconsfield 89.5858 Bedford 92.329 BellePlaine 90.9574 Bellevue 87.249 Blockton 92.1512 Bloomfield 96.5708 Boone 92.202 Brighton 85.3186 Britt 80.1116 Buckeye 85.4964 BurlingtonKBUR 96.3676 Burlington 93.8276 Carroll 84.6582 Cascade 85.0392

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual C# .NET

Authors: Ying Bai

1st Edition

0470467274, 978-0470467275

More Books

Students also viewed these Databases questions

Question

Time required (hours or days) to make the change, tchange.

Answered: 1 week ago