Question: Create a loop that will execute 7 times: the number of days the user has been tracking their calories. In the loop, The prompt for

  • Create a loop that will execute 7 times: the number of days the user has been tracking their calories. In the loop,
    • The prompt for the user should include the value of the loop counter + 1; see example below

calories = int(input("Day " + str(counter + 1) + ": ")

    • User should enter the number of calories consumed for each day
    • Computer should total the calories as they are entered
  • When all 7 days have been entered, calculate the average number of calories consumed per day
  • Display the total number of calories and the average

Sample Input:

Please enter the total number of calories you have consumed for each of the last 7 days:

Day 1: 1789

Day 2: 1802

Day 3: 1644

Day 4: 1705

Day 5: 1934

Day 6: 1607

Day 7: 1754

Sample Output:

Total calories consumed during the week: 12,235

Average calories consumed per day: 1,747

Using Python

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!