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.
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.
3. Type an input line (with float) to ask the user their height in metres.
4. print a reply that uses their response.
Embedded Python Editor
Powered by trinket.io