Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
I need more python help. Please?
Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program should first ask for the number of 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 loop will ask the user for the inches of rainfall for that month.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.
We never learned what an iteration was. Is there anyone that can explain how to set iterations up?
1 Answer
- Anonymous1 decade agoFavorite Answer
An iteration is a single turn through the loop.
So, for each year you want to loop over the 12 months and ask for hte rainfall for each month. Each month would be an iteration in that loop. For a total of 12 iterations.
If you did this for 3 years, then you would loop over each month three times for a total of 36 iterations.
I hope this helped you understand iterations.
If you still need help with the python program, then don't hesitate to send me an email (irishtek@yahoo.com) and I'll provide you with the guidance you need.