Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
The for loop
5. for loop with range() – Exercise 2
The while loop
Nested loops
break and continue
Summary

Instruction

Great! Let's do one more exercise, this time slightly more complicated.

Exercise

Ask the user to provide their age, and store the age in a variable named current_age. Next, print four sentences that will tell the user how old they will be in 2, 3, 4, and 5 years:

In {x} years, you will be {current_age + x} years old!

Stuck? Here's a hint!

The syntax of for loop is:

for i in range(a, b):
  ...