Saving Up

One cup costs price, 2 EUR, and you're saving up for new inline skates, which cost goal, 150 EUR. Both are in new variables. Add two lines to the report: how much you earned in the whole week, and on which day the money you had earned so far reached the price of the skates.

Cups sold: 122
Average: 17.4 cups a day
Best day: day 5 (30 cups)
Earned: 244 EUR
Goal reached on day 5

After four days, you had 128 EUR, which isn't enough yet. On the fifth day, you sold 30 more cups, and with 188 EUR, you can buy the skates.

If even a whole week's money isn't enough, print how much is missing instead. With skates for 300 EUR, the last line would be Goal not reached: 56 EUR missing.

A tip: once you know the day, the loop doesn't need to go on. Remember break from the lesson on loops, and the variable that keeps what the loop found.

Instructions

Print how much you earned in the whole week.

Print on which day you reached the goal, or how much is missing.

Start programming for free

By signing up, you agree to the Terms of Service and Privacy Policy.

Or sign up with:

2/3