Consider this input code to find half of the number that you input:
>>> a = int(input("Please input a number: "))
Please input a number: 4
>>> if(a/2 == a/2):
... a/=2
... print("Half of the number than you input is:",a)
...
Half of the number than you input is: 2.0
When I input it, it was a int
, but why has it changed from int
to float
? Note: If I enter numbers that requires to print out decimal points such as 5
, it will print 2.5
.