The Daily Goal
Your goal is 10,000 steps a day, and it's in a new variable, goal. A day counts when you walked at least that many steps. Add two lines to the report: on how many days you reached the goal, and your longest streak, the most days in a row on which you reached it.
Total: 63000 steps
Average: 9000.0 steps a day
Best day: Sat (15800 steps)
Goal reached: 3 of 7 days
Longest streak: 2 daysYou reached the goal on Wednesday, Friday and Saturday. Thursday broke the streak, so the longest one is Friday and Saturday: 2 days.
A tip for the streak: while the loop goes through the days, count the days of the current streak. A day below the goal ends it, and the count starts again from 0. Keep the longest count, the way you kept the largest value in the lesson on loops.
Instructions
Print on how many of the days you reached the goal.
Print the longest streak.
Start programming for free
2/3