Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Tort |
print(float(1))
1
Why not 1.0?
try printing float(0.1) instead
rustyStriker | 2018-02-13 13:54
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Tort |
print(float(1))
1
Why not 1.0?
try printing float(0.1) instead
rustyStriker | 2018-02-13 13:54
Reply From: | Zylann |
You are getting a float. You don’t get .0
because there is no need to show any decimals.
Suddenly suddenly :\
Tort | 2018-02-13 14:09
Reply From: | literalcitrus |
If you really want to display 1.0
then look into using format strings. For your example use print("%.1f" % float(1))
.