0

print(int(input("Enter a number: ")) + float (input("Enter another number: "))) why this code gives float type output?

different types using in same statement

10th Jun 2018, 1:59 PM
Sathya R
Sathya R - avatar
1 Antwort
+ 1
I think it's because adding a whole number and a number that has decimals will result in a number with decimals and you're not changing its type.
10th Jun 2018, 2:06 PM
Alexandru Turculet
Alexandru Turculet - avatar