top of page
top

Python - Section 3 Practice Tasks

noun-calculation-2008032-FFFFFF.png

Task One: Square Number

Create a program that asks the user to input a number and then prints the square of that number - to do this, multiply the number by itself.

Remember: Break up variables and parts of a sentence in a print line by using commas. 

Example solutions:

Enter a number: 12
The square of 12 is 144

Enter a number: 7
The square of 7 is 49

Task Two: Multiplying Numbers

X

Example solutions:

Create a program that asks the user to input two numbers (num1 and num2). Multiply the two numbers together and print the total

 

Remember: Break up integer variables in a print line by using commas between each part of the sentence. 

Enter number one: 7
Enter number two: 9
7 x 9 = 63

Enter number one: 8
Enter number two: 12
8 x 12 = 96

Task Three: Turning 65

Example solutions:

Create a program to input how old the user will turn this year and then print the year they will turn 65.

You could do this in just two lines but before trying that work out on paper the steps to

calculating your own age you will turn 65. What steps did you take? Try to recreate those steps
in Python.

 

You might need to create another variable to make it easier.

How old will you turn this year? 15
You will turn 65 in 2073

How old will you turn this year? 42
You will turn 65 in 2046

Task Four: Multiplication Table

Let the user enter a number then print the first five multiplications in its times table.

This can be done more simply when you learn about for loops but for now you will need to multiply the number by 1, then multiply it by 2 etc.

Try to make this program better by displaying the number and the value it is multiplied by in your print statements.

Simple example solution:

Enter a number: 8
8 16 24 32 40

Better example solution:

Enter a number: 7
7 x 1 = 7
7 x 2 = 14
7 x 3 = 21
7 x 4 = 28
7 x 5 = 35

bottom of page