Once you have filled in the prediction column, check your answers in interactive mode and write the actual result.
Input | Prediction | Result |
---|---|---|
float('1') |
||
str(1 + '2') |
||
str('2') |
||
int('abc') |
||
int(float('1.6')) |
||
float(int(1.6)) |
||
str(float(1)) |
-
Create a program which will take in an input and print out that input divided by 2.
-
Alter one line of that program to return only whole numbers.
Make your program have two modes: an integer mode and a float mode.
Add another input to ask which mode the user wants to use.
If the user asks for integer mode, then print out integers as the result of your division. Otherwise print out floating-point values (decimals).