3) Adaptation: avg_rainfall_fun.py This is a redesign of a previous assignment. Start with a working copy of avg_rainfall.py program from the last lab (provided in D2L resources if necessary). Re-design the program to use all of our new standard features, plus the old ones:

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter7: File Handling And Applications
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
B ASS
ENTS,
How many years are in your rainfall sample? 2
Rainfall info for year #1:
3) Adaptation: avg_rainfall_fun.py
Enter rain for month # 1: 2
Enter rain for month # 2: 2
Enter rain for month # 3: 2
This is a redesign of a previous assignment.
Enter rain for month # 4: 2
Enter rain for month # 5: 2
Start with a working copy of avg_rainfall.py program
from the last lab (provided in D2L resources if
necessary).
Enter rain for month # 6: 2
Enter rain for month # 7:2
Enter rain for month # 8: 2
Enter rain for month # 9: 2
Enter rain for month #10: 2
Enter rain for month #11: 2
068
Enter rain for month #12: 2
Re-design the program to use all of our new
standard features, plus the old ones:
Total rain in inches for year #1 = 24.0
Year
I Monthly Avg Rainfall = 2.00
%3D
Rainfall info for year #2:
Enter rain for month # 1: 1
Interactive functions called main(), inputs(),
processing(), and outputs(), plus the separate
get_pos_int() validation function
Enter rain for month # 2: 1
Enter rain for month # 3: 1
Enter rain for month # 4: 1
Enter rain for month # 5: 1
Enter rain for month # 6: 1
Enter rain for month # 7: 1
Exception handling & restart in main()
Enter rain for month # 8: 1
Enter rain for month # 9: 1
"""docstring""" & # short comments
Enter rain for month #10: 1
Enter rain for month #11: 1
Enter rain for month #12: 1
The old and new programs will seem the same to
the user. It was tricky before, and this is an added
challenge. It will make the program easier to read
and debug! Indentation levels are key!
Total rain in inches for year #2 = 12.0
Year #2 Monthly Avg Rainfall = 1.00
Total rain, all years = 36.0 inches
Average monthly rain, all years = 1.5 inches
Thanks for using the program
%3D
4
Transcribed Image Text:B ASS ENTS, How many years are in your rainfall sample? 2 Rainfall info for year #1: 3) Adaptation: avg_rainfall_fun.py Enter rain for month # 1: 2 Enter rain for month # 2: 2 Enter rain for month # 3: 2 This is a redesign of a previous assignment. Enter rain for month # 4: 2 Enter rain for month # 5: 2 Start with a working copy of avg_rainfall.py program from the last lab (provided in D2L resources if necessary). Enter rain for month # 6: 2 Enter rain for month # 7:2 Enter rain for month # 8: 2 Enter rain for month # 9: 2 Enter rain for month #10: 2 Enter rain for month #11: 2 068 Enter rain for month #12: 2 Re-design the program to use all of our new standard features, plus the old ones: Total rain in inches for year #1 = 24.0 Year I Monthly Avg Rainfall = 2.00 %3D Rainfall info for year #2: Enter rain for month # 1: 1 Interactive functions called main(), inputs(), processing(), and outputs(), plus the separate get_pos_int() validation function Enter rain for month # 2: 1 Enter rain for month # 3: 1 Enter rain for month # 4: 1 Enter rain for month # 5: 1 Enter rain for month # 6: 1 Enter rain for month # 7: 1 Exception handling & restart in main() Enter rain for month # 8: 1 Enter rain for month # 9: 1 """docstring""" & # short comments Enter rain for month #10: 1 Enter rain for month #11: 1 Enter rain for month #12: 1 The old and new programs will seem the same to the user. It was tricky before, and this is an added challenge. It will make the program easier to read and debug! Indentation levels are key! Total rain in inches for year #2 = 12.0 Year #2 Monthly Avg Rainfall = 1.00 Total rain, all years = 36.0 inches Average monthly rain, all years = 1.5 inches Thanks for using the program %3D 4
LAB ASSIGNMENTS, CONT.
How many years are in your rainfall sample? 2
Rainfall info for year #1:
Enter rain for month # 1: 2
Enter rain for month # 2: 2
Enter rain for month # 3: 2
avg_rainfall.py: Write a program that collects rainfall data and calculates
the average rainfall for a user-defined number of years.
Enter rain for month # 4: 2
Enter rain for month # 5: 2
Enter rain for month # 6: 2
Enter rain for month # 7: 2
Ask the user for the number of years in their study - use a small number
to test, like 2, because you have to collect 12 months of data for each
year!
Enter rain for month # 8: 2
Enter rain for month # 9: 2
Enter rain for month #10: 2
Enter rain for month #11: 2
Enter rain for month #12: 2
Total rain in inches for year #1 = 24.0
Year #1 Monthly Avg Rainfall = 2.00
Rainfall info for year #2:
The outer loop will run once for each year (hint: use range function).
Enter rain for month # 1: 1
The inner loop will run once for each of 12 months, and ask the user for a
rainfall amount for that month. The inner loop will accumulate a total for each
Enter rain for month # 2: 1
Enter rain for month # 3: 1
Enter rain for month # 4: 1
year.
Enter rain for month # 5: 1
Enter rain for month # 6: 1
Enter rain for month # 7: 1
The outer loop will finish by calculating average monthly rainfall for that
Enter rain for month # 8: 1
Enter rain for month # 9: 1
year.
Enter rain for month #10: 1
Enter rain for month #11: 1
At the end of each year, display the total for the year and the average.
Enter rain for month #12: 1
Total rain in inches for year #2 = 12.0
Year #2 Monthly Avg Rainfall = 1.00
Challenge: add a feature to show the total and average rainfall for the
entire study period (multi-year figures).
Total rain, all years = 36.0 inches
Average monthly rain, all years = 1.5 inches
Thanks for using the program
Transcribed Image Text:LAB ASSIGNMENTS, CONT. How many years are in your rainfall sample? 2 Rainfall info for year #1: Enter rain for month # 1: 2 Enter rain for month # 2: 2 Enter rain for month # 3: 2 avg_rainfall.py: Write a program that collects rainfall data and calculates the average rainfall for a user-defined number of years. Enter rain for month # 4: 2 Enter rain for month # 5: 2 Enter rain for month # 6: 2 Enter rain for month # 7: 2 Ask the user for the number of years in their study - use a small number to test, like 2, because you have to collect 12 months of data for each year! Enter rain for month # 8: 2 Enter rain for month # 9: 2 Enter rain for month #10: 2 Enter rain for month #11: 2 Enter rain for month #12: 2 Total rain in inches for year #1 = 24.0 Year #1 Monthly Avg Rainfall = 2.00 Rainfall info for year #2: The outer loop will run once for each year (hint: use range function). Enter rain for month # 1: 1 The inner loop will run once for each of 12 months, and ask the user for a rainfall amount for that month. The inner loop will accumulate a total for each Enter rain for month # 2: 1 Enter rain for month # 3: 1 Enter rain for month # 4: 1 year. Enter rain for month # 5: 1 Enter rain for month # 6: 1 Enter rain for month # 7: 1 The outer loop will finish by calculating average monthly rainfall for that Enter rain for month # 8: 1 Enter rain for month # 9: 1 year. Enter rain for month #10: 1 Enter rain for month #11: 1 At the end of each year, display the total for the year and the average. Enter rain for month #12: 1 Total rain in inches for year #2 = 12.0 Year #2 Monthly Avg Rainfall = 1.00 Challenge: add a feature to show the total and average rainfall for the entire study period (multi-year figures). Total rain, all years = 36.0 inches Average monthly rain, all years = 1.5 inches Thanks for using the program
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,