In python why it is print 5.0 Instead of print 5 .When we use following condition -----> print(10/2) ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In python why it is print 5.0 Instead of print 5 .When we use following condition -----> print(10/2) ?

19th Oct 2022, 2:38 AM
ARAVIND DUDE
ARAVIND DUDE - avatar
4 Answers
+ 2
ARAVIND DUDE , Single slash division gives float value Double slash gives whole number.. It is the basic thing in python Go through the python beginners course...
19th Oct 2022, 4:27 AM
Riya
Riya - avatar
+ 1
Using a single slash to divide numbers produces a decimal (or float, as it’s known in programming).
19th Oct 2022, 2:39 AM
Mozzie
Mozzie - avatar
+ 1
ARAVIND DUDE Using print(10//2) will print 5
19th Oct 2022, 3:07 AM
Mozzie
Mozzie - avatar
0
Kim Jonas Cabugayan it is a int data type but. why it is printing a float datatype ?
19th Oct 2022, 2:42 AM
ARAVIND DUDE
ARAVIND DUDE - avatar