top of page
Python 2B - Inputting Numbers
Inputting Numbers in Python
To enter whole numbers then you must use the int command.
int stands for integer (a whole number) and is typed before input – don’t forget the double brackets at the end.

=

Using float instead of int allows a decimal number to be entered instead.
Again, don’t forget the double brackets at the end.

=

Practice Task 1
1. Type an input line (with int) to ask the user how many times they’ve been to the zoo.
2. print a reply that uses their response.
Example solution:

Practice Task 2
1. Type an input line (with float) to ask the user their height in metres.
2. print a reply that uses their response.
Example solution:

Embedded Python Editor
Powered by trinket.io
bottom of page