Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Raptor Flow Chart Question: Average Rainfall Write a algorithm and Python program that uses nested loops to collect data and calculate the average rainfall over

Raptor Flow Chart image text in transcribed
image text in transcribed
Question: Average Rainfall Write a algorithm and Python program that uses nested loops to collect data and calculate the average rainfall over period of years. 1. The program has a function named getYear. The function asks the user to enter the number of years and return the number. Input validation is need for the year: do not accept negative number of years or O for years. 2. The program has a function named getRainfall. The function asks the user to enter the rainfall for a month and return that number. (Input validation: do not accept negative number for the rainfall) 3. The program has a function named calcAvg Rain to calculate and return the average monthly rainfall over a period of years. It accepts the number of years as argument. The function uses a nested loop to collect the rainfall for those many years. The outer loop will iterate once for each year. The inner loop will iterate twelve times, once for each month Each iteration of the inner loon will for each month. Each iteration of the inner loop will call the function defined in step 2 to get the rainfall of a month. Then that rainfall will be accumulated to the total rainfall. After all iterations, the program should display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period. 4. The main module calls the above functions in proper order

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

Step: 3

blur-text-image

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

Semantics In Databases Second International Workshop Dagstuhl Castle Germany January 2001 Revised Papers Lncs 2582

Authors: Leopoldo Bertossi ,Gyula O.H. Katona ,Klaus-Dieter Schewe ,Bernhard Thalheim

2003rd Edition

3540009574, 978-3540009573

More Books

Students also viewed these Databases questions

Question

a. Are you aware of any undesirable gestures that may affront?

Answered: 1 week ago