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
Originally posted by jdonwells February 3, 2022
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)
The text was updated successfully, but these errors were encountered:
Discussed in #330
Originally posted by jdonwells February 3, 2022
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:
The text was updated successfully, but these errors were encountered: