0

How did he get this answer

>>> float(input("Enter a number: ")) + float(input("Enter another number: ")) Enter a number: 40 Enter another number: 2 42.0

22nd Sep 2017, 10:39 AM
MelioCurry
MelioCurry - avatar
2 Answers
+ 4
This is because float type will print values with decimals, even if the result doesn't require one. In this case you can do: int(input("enter a number")) + int(input("enter another number")) enter a number: 40 enter another number: 2 42
22nd Sep 2017, 1:00 PM
Cool Codin
Cool Codin - avatar
0
so are u gonna enter the number at the place where it says "enter number"
24th Sep 2017, 12:57 PM
MelioCurry
MelioCurry - avatar