0

What would be the difference between "7" and "7.0"

I'm very confused on that, can someone explain to me

18th Jul 2019, 7:47 PM
Kenny Stumpmier
Kenny Stumpmier - avatar
2 Answers
+ 5
The 7 is an integer, while the 7.0 is a double. The difference between an int and a double is that doubles are more specified. For instance, if you wanted to show your current local temperature as accurate as possible, you would want to use double, since you could be more specific. The int-value rounds up or down, depending on the closest whole number. An int with 7.2 would show as 7, but a double would show as 7.2
18th Jul 2019, 7:51 PM
Roolin
Roolin - avatar
+ 5
In Python, the term "double" isn't really used. It's better to use "float".
20th Jul 2019, 5:48 AM
David Ashton
David Ashton - avatar