Question

Write them in python IDLE *****

5. Average Rainfall

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


5. Average Rainfall Write a program that uses nested loops to collect data and calculate the average raintall 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.

11. Weight Loss

If a moderately active person cuts their calorie intake by 500 calories a day, they can typically lose about 4 pounds a month. Write a program that lets the user enter their starting weight, then creates and displays a table showing what their expected weight will be at the end of each month for the next 6 months if they stay on this diet.


0 0
Add a comment Improve this question Transcribed image text
Answer #1

Feel free to reach out if you have doubts.
Please do rate if the answer was helpful.
Thanks

-----------------------------------------------------------------------------------------------------
Copyable Code:
-----------------------------------------------------------------------------------------------------
Average rainfall program:

В asd.py-G/Users/Rohit/AppData/Local/Programs/Python/Python36-32/asd.py (3.6.4) File Edit Format Run Options Window Help | ye


years = 0;
monthly = -1;
total = 0;
years=int(input("Enter number of years :"))
for i in range(0,years):
print("Year :",i+1);
for j in range(0,12):
while (monthly<0):
print("Enter Monthly Raifall for month ",j+1);
monthly=int(input())
total+=monthly;
monthly=-1;
print("In ",years*12,"months there was ",total," inches of rainfall");
print("The average rainfall for this time period was ","{0:.2f}".format(total/(years*12)),"inches");


-----------------------------------------------------------------------------------------------------
SAMPLE OUTPUT:

Enter number of years :l Year 1 Enter Monthly Raifall for month 1 Enter Monthly Raifall for month 2 Enter Monthly Raifall for

-----------------------------------------------------------------------------------------------------

Weight Loss Program

Le asd.py - C:/Users/Rohit/AppData/Local/Programs/Python/Python36-32/asd.py (3.6.4) File Edit Format Run Options Window Help

current = int(input ("Enter your current weight: "))
goal = int(input ("Enter your goal weight: "))
count = 0
print("Month", "Weight")
for i in range(current, goal-1, -4):
print(count,i)
count = count + 1
print("In month",count,"you will reach your goal!")

-----------------------------------------------------------------------------------------------------
SAMPLE OUTPUT:

Enter your current weight: 76 Enter your goal weight: 45 Month Weight 0 76 1 72 2 68 3 64 4 60 5 56 6 52 7 48 In month 8 you

  

  
  
  
  

Add a comment
Know the answer?
Add Answer to:
Write them in python IDLE ***** 5. Average Rainfall Write a program that uses nested loops...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Average Rainfall Design a program that uses nested loops to collect data and calculate the average...

    Average Rainfall Design 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...

  • Design a program that uses nested loops to collect data and calculate the average rainfall over...

    Design 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 iterte twelve times, onece for each month. Each itertion of the inner loop will ask the user for the inches of rainfall for tht month. After all iterations, the program should display the number of months, the...

  • Write a program that uses nested loops to collect data and calculate the average rainfall over...

    Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program should prompt the user for the number of years. Be sure to ask for each months average rainfall for each year. The outer loop will iterate once for each year while the inner loop will iterate 12 times(one time per month) prompting for the months average rainfall on each iteration. Display the number of months, the total inches...

  • 5. Create a java application that uses nested loops to collect data and calculate the average...

    5. Create a java application that uses nested loops to collect data and calculate the average rainfall over a peniod of years First the program should ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate 12 times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month, the program should display the number of months, the total...

  • Small Basic Programming Question: Average score Write a program that uses loops to collect data and...

    Small Basic Programming Question: Average score Write a program that uses loops to collect data and calculate the average score over a number of tests for a number of students. The program should : 1. first ask the user to enter the number of students in the range of 1 to 10. 2. then the program asks the user to enter the number of tests (in the range of 1 to 5) 3. Then use a loop to collect the...

  • Small Basic Programming Question: Average Score- Write a program that uses loop to collect data and...

    Small Basic Programming Question: Average Score- Write a program that uses loop to collect data and calculate the average score over a number of tests for a number of students. The program should: 1. first ask the user to enter the number of students in the range of 1 to 10. 2. then the program asks the user to enter the number of tests (in the range of 1 to 5) 3. Then use a loop to collect the scores...

  • PYTHON PROGRAMMING - CODE THE PROGRAM BASED ON THE INSTRUCTIONS AND ALGORITHM PROVIDED home / study...

    PYTHON PROGRAMMING - CODE THE PROGRAM BASED ON THE INSTRUCTIONS AND ALGORITHM PROVIDED home / study / engineering / computer science / questions and answers / python programming - code the program based on ... Your question has been answered! Rate it below. Let us know if you got a helpful answer. Question: PYTHON PROGRAMMING - CODE THE PROGRAM BASED ON THE... Bookmark PYTHON PROGRAMMING - CODE THE PROGRAM BASED ON THE INSTRUCTIONS AND ALGORITHM PROVIDED Rainfall Algorithm Declare and...

  • In this assignment, you will write a program in C++ which uses files and nested loops...

    In this assignment, you will write a program in C++ which uses files and nested loops to create a file from the quiz grades entered by the user, then reads the grades from the file and calculates each student’s average grade and the average quiz grade for the class. Each student takes 6 quizzes (unknown number of students). Use a nested loop to write each student’s quiz grades to a file. Then read the data from the file in order...

  • Write a Python program that allows the user to enter the total rainfall for each of...

    Write a Python program that allows the user to enter the total rainfall for each of 12 months into a list. The program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest rainfall amounts. Data: January: 8.9 inches February: 11.1 inches March: 13.4 inches April: 6.9 inches May: 8.7 inches June: 9.1 inches July: 15.9 inches August: 4.4 inches September: 3.1 inches October: 5.6 inches November: 7.8...

  • Poly-Poly + a[i] * power 6. (15%) Consider the nested loops shown below, where N is...

    Poly-Poly + a[i] * power 6. (15%) Consider the nested loops shown below, where N is assumed to be a power of 2. i.e., N-2 for some positive integer k. i=N; while (i>-1){ while (j =N){ j-2 *j; i=i/2. a) Determine the number of outer iterations (associated with the outer while loop) to be executed? Show your work. b) For each outer iteration (for each value of i), determine the number of iterations of the inner while loop to be...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT