0
What is the difference between "1" and "1.0" in python
Example: Print((4+8)/2) In this statement the answer"6.0" is right and "6" is wrong. What is the main reason ?
7 Respuestas
+ 6
Division results in a float result, e.g. 6.0.
6 is an integer
+ 5
When arithmetic expression uses floor division ("/") it returns a floating point value. If you want to return an integer value you have to use integer division("//") instead of floor division("/").
+ 2
One is float (means with decimal point like 8.8888) and other one is integer (means whole number like example 8) :) and / means division but it will give output of float to get the integer you have to use //
+ 2
Khan Hamza Khan No problem but use search bar for these FAQ because these questions are asked already too many times it will be much easy to get these answers from there and fastly
0
Thank you all 😍
0
Ok Sayyam Jain
0
Put simply, 1 is an integer, 1.0 is a float. (though this has been said by many other people).