How old will you be in…

In this challenge we will write a Python program to help us find out hold we will be in the coming years! We have designed the algorithm of our program using both a Flowchart and Pseudocode.

Algorithm

FlowchartPseudocode
how-old-flowchart

year = 2017
age = INPUT("How old are you?")
FOR i FROM 1 TO 50
   year = year + 1
   age = age + 1
   OUTPUT("In " + year + ", you will be " + age + " years old.")
END FOR

Reviewing the Algorithm


Check the above pseudo-code and answer the following questions:


?
What variables are used in this code?


?
On what line is iteration used?


?
What value is used to initialise the variable year?


?
On what line is the variable age incremented?


?
On which line is string concatenation used?


?
How many lines will be displayed on screen once this program has been fully executed?


?
What would be the last line to appear on screen once this program has been fully executed?

Check the above flowchart and answer the following questions:


?
In a flowchart, what shape is used to represent a user INPUT?


?
In a flowchart, what shape is used to represent iteration?


?
In a flowchart, what shape is used to represent an OUTPUT?

Python Code


Your task is to use the algorithm provided above (either Flowchart or Pseudo-code) to code this algorithm using Python.

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 4.2 / 5. Vote count: 88

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!

Tagged with: , ,