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:...


LAB ASSIGNMENTS, CONT.<br>How many years are in your rainfall sample? 2<br>Rainfall info for year #1:<br>Enter rain for month # 1: 2<br>Enter rain for month # 2: 2<br>Enter rain for month # 3: 2<br>avg_rainfall.py: Write a program that collects rainfall data and calculates<br>the average rainfall for a user-defined number of years.<br>Enter rain for month # 4: 2<br>Enter rain for month # 5: 2<br>Enter rain for month # 6: 2<br>Enter rain for month # 7: 2<br>Ask the user for the number of years in their study - use a small number<br>to test, like 2, because you have to collect 12 months of data for each<br>year!<br>Enter rain for month # 8: 2<br>Enter rain for month # 9: 2<br>Enter rain for month #10: 2<br>Enter rain for month #11: 2<br>Enter rain for month #12: 2<br>Total rain in inches for year #1 = 24.0<br>Year #1 Monthly Avg Rainfall = 2.00<br>Rainfall info for year #2:<br>The outer loop will run once for each year (hint: use range function).<br>Enter rain for month # 1: 1<br>The inner loop will run once for each of 12 months, and ask the user for a<br>rainfall amount for that month. The inner loop will accumulate a total for each<br>Enter rain for month # 2: 1<br>Enter rain for month # 3: 1<br>Enter rain for month # 4: 1<br>year.<br>Enter rain for month # 5: 1<br>Enter rain for month # 6: 1<br>Enter rain for month # 7: 1<br>The outer loop will finish by calculating average monthly rainfall for that<br>Enter rain for month # 8: 1<br>Enter rain for month # 9: 1<br>year.<br>Enter rain for month #10: 1<br>Enter rain for month #11: 1<br>At the end of each year, display the total for the year and the average.<br>Enter rain for month #12: 1<br>Total rain in inches for year #2 = 12.0<br>Year #2 Monthly Avg Rainfall = 1.00<br>Challenge: add a feature to show the total and average rainfall for the<br>entire study period (multi-year figures).<br>Total rain, all years = 36.0 inches<br>Average monthly rain, all years = 1.5 inches<br>Thanks for using the program<br>

Extracted 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
Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here