Page 1 of 1

This is one full question. Please write in Python.

Posted: Wed Apr 27, 2022 3:38 pm
by answerhappygod
This is one full question. Please write in Python.
This Is One Full Question Please Write In Python 1
This Is One Full Question Please Write In Python 1 (186.69 KiB) Viewed 30 times
This Is One Full Question Please Write In Python 2
This Is One Full Question Please Write In Python 2 (278.2 KiB) Viewed 30 times
2. (8 points) Suppose you're training for a footrace, and you've been keeping track of your total miles run per week. You have data for several weeks now, and you want to determine whether you've been steadily increasing your weekly mileage. Write a program named run analyzer.py that allows the user to enter their number of miles run each week. The program should begin by allowing the user to specify how many weeks of data to enter. Then store this weekly data into a list. Include input validation to ensure that the user enters at least 2 weeks of data, and that each week's data is not negative. The program should then determine and report whether the data is consistently increasing. (If the miles run in any week are less than or equal to the miles run in the previous week, the data is not consistently increasing.) The program should also compute and display the average mileage change from week to week. This average mileage change should be computed and displayed regardless of whether the data is consistently increasing. Example program run (underlined parts indicate what the user enters) How many weeks of data do you have? 1 Must enter at least 2 weeks, try again: 5 Enter miles run for week 1: 3 Enter miles run for week 2: -3 You can't run a negative number of miles, try again: 3.2 Enter miles run for week 3: 3.8 Enter miles run for week 4: 4 Enter miles run for week 5: 4.5 Your weekly mileage is consistently increasing! Average weekly change: 0.375 Example program run (underlined parts indicate what the user enters)
Example program run (underlined parts indicate what the user enters) How many weeks of data do you have? 5 Enter miles run for week 1: 11 Enter miles run for week 2: 10 Enter miles run for week 3: 12 Enter miles run for week 4: -0.01 You can't run a negative number of miles, try again: -14 You can't run a negative number of miles, try again: 12 Enter miles run for week 5: 15 Your weekly mileage is NOT consistently increasing! Average weekly change: 1.0 1 This problem could technically be done without using any lists. But you must store the data into a list to get full credit!