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.
thisYear = 2015
print("We are in " + str(thisYear))
age = int(input("How old are you?"))
print("You are " + str(age) + " years old.")
Challenge #1: How old will you be in…
- In 2016 you will be … years old.
- In 2017 you will be … years old.
- …
- In 2050 you will be … years old.
thisYear = 2015
print("We are in " + str(thisYear))
age = int(input("How old are you?"))
print("You are " + str(age) + " years old.")
for i in range(0,36):
thisYear += 1
age += 1
print("In " + str(thisYear) + " you will be " + str(age) + " years old.")
Challenge #2: How old will you be in 2050 (without using a loop).
- In 2050 you will be … years old.
thisYear = 2015
print("We are in " + str(thisYear))
age = int(input("How old are you?"))
print("You are " + str(age) + " years old.")
yearsDifference = 2050 - thisYear
age = age + yearsDifference
print("In 2050 you will be " + str(age) + " years old.")
Challenge #3: When were your born?
- You were born in ….
thisYear = 2015
print("We are in " + str(thisYear))
age = int(input("How old are you?"))
print("You are " + str(age) + " years old.")
birthYear = thisYear - age
print("You were born in " + str(birthYear) + ".")
Challenge #4: In how many years will you turn 21!
thisYear = 2015
print("We are in " + str(thisYear))
age = int(input("How old are you?"))
print("You are " + str(age) + " years old.")
if age<21:
yearsDifference = 21 - age
print("You will be 21 in " + str(yearsDifference) + " years.")
elif age==21:
print("You are 21 years old this year!")
elif age>21:
yearsDifference = age - 21
print("You were 21 years old " + str(yearsDifference) + " years ago.")
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.

Solution...
The solution for this challenge is available to full members!Find out how to become a member:
➤ Members' Area
When designing electronic circuits you may need to use resistors. Each resistor has a resistance value expressed in ohms (Ω). Resistors are identified by a series of concentric coloured bands. Each band colour has a value which is used to calculate the resistance value of the resistor.



Meet E.V.E., a computer algorithm with artificial intelligence. E.V.E. can communicate with human beings. Well it’s only a start and we need you to complete the code provided below for E.V.E to be able to communicate more effectively with teenagers.






In this challenge we are looking at how a list can be used to store all the players’ names of a football team.



In this challenge we are going to write a Python program that automatically generates six random numbers (from 1 to 50) and display them on the screen, sorted in ascending order.


In this challenge you are going to create a blackjack game for one player. The computer will be the dealer.


