# Year 2050

Have you got any idea how old you will be in 2050?

By completing the following challenges we will write computer algorithms for the computer to tell us more about our age in the future!

#### Getting Started

First you will need to copy the following code in your Python IDE or using an online Python editor.

#### Challenge #1: How old will you be in…

ChallengeSolution
Complete the above code with a for loop to display the following messages:
• In 2016 you will be … years old.
• In 2017 you will be … years old.
• In 2050 you will be … years old.

#### Challenge #2: How old will you be in 2050 (without using a loop).

ChallengeSolution
Complete the above code without using a for loop to display the following message:
• In 2050 you will be … years old.

#### Challenge #3: When were your born?

ChallengeSolution
Tweak your code so that the Python program calculates and displays the year you were born. For instance it will display:
• You were born in ….

#### Challenge #4: In how many years will you turn 21!

ChallengeSolution
Tweak your code so that the Python program calculates and displays how many years till your turn 21. Note that if the end-user is older than 21, then the program should tell them how many years have passed since their 21st birthday.

#### Extension

In all the challenges listed above we hardcoded the current year to 2015. This means that our programs will not work next year unless we change the code on line 1: from thisYear = 2015 to thisYear = 2016.

Instead we can improve our code by getting Python to find out what year we are currently in.

The following lines of code show you how to achieve this. You can reuse them to tweak your code.

Tagged with: , ,