Page 1 of 4
Henris Python Programming
Calculator script - 15.12.14
Informs the user of what each
option does by printing out
what it does on each line on
the Python Shell. (e.g. Option
3 is multiply)
Integers are used because the options are whole
numbers and text/decimals cannot be inputted.
Asks the user to input a option
Float is used to ensure no
text is being inserted.
Asks the user to input the
numbers of their problem for
the calculator to calculate
The value which the user gave
for both of the numbers are
now multiplied and displayed
If a option other than the one
listed is selected (e.g. text)
then the program is stopped.
Page 2 of 4
Calculator script - shell
121+10=131
121 x 2 = 242
Page 3 of 4
If statements - lesson 12.12.14
Asks the user to input a whole
number of how much hours
he/she plays computer games
If it isnt 2 or below
then it prints a
different message
The script then checks
if the answer was 2 or
below, then prints a
message
Page 4 of 4
Functions - Lesson 5.12.14
Weve defined a function printinfo,
with name, age and hobby
Once its called, it will print out the
following.
Here we call the function with some
values
It then follows the script by
printing the values to the shell