+ 1
Whats the difference between 6 & 6.0?
i think both are the same but why do Python treat them differently?
3 Answers
+ 6
6 is an integer.
6.0 is a floating-point value.
0
in most programming language:
6 = int.
6.0 = double.
6.0f or 6.f = float.
0
6 indicates integer value.
whereas 6.0 indicates floating. if you declare integer but used floating value the calculation will be shown wrong. ex: you declared int x, but used x=6.86. the printf will show 6 only.