0
What's the difference between 1 and 1.0? Do they have different use?
Is there any difference between 1 and 1.0? For example what's the difference between' print ('1') and print('1.0')
2 Réponses
+ 4
1 is integer type
1.0 is float type
By default in python, numeric value are of float type and not integer. So,
print(1) #output 1.0
print(1.0) #output 1.0