Why does the following code gives me output (5.0) of float type while I has given input of int type | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why does the following code gives me output (5.0) of float type while I has given input of int type

Print(10/5)

17th Oct 2019, 4:02 PM
Abhinav
Abhinav - avatar
2 Answers
+ 5
In Python, / is float division. Using it will always result in a float value. If you want integer division, use // print(10//5)
17th Oct 2019, 4:04 PM
Hatsy Rei
Hatsy Rei - avatar
+ 1
Thanx for explaining
18th Oct 2019, 1:31 AM
Abhinav
Abhinav - avatar