You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The bonus to lab 2.01 has to use conditional statements which the kids don't know yet.
So I changed it to this:
In your editor
Create a program that will take an input and print out that input multiplied by 2.
Does it work if you enter a float like 1.6? Can you fix it?
Make your program print the result as an integer, then as a float, and again as a string that is repeated twice.
Printing as an integer will require them to cast twice. 1.6*2 as an integer should print 3, not 2. Example solution:
number = input('Enter a number: ')
print(int(float(number) * 2))
print(float(number) * 2)
print(number * 2)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The bonus to lab 2.01 has to use conditional statements which the kids don't know yet.
So I changed it to this:
In your editor
Create a program that will take an input and print out that input multiplied by 2.
Does it work if you enter a float like 1.6? Can you fix it?
Make your program print the result as an integer, then as a float, and again as a string that is repeated twice.
Printing as an integer will require them to cast twice. 1.6*2 as an integer should print 3, not 2. Example solution:
Beta Was this translation helpful? Give feedback.
All reactions