Floor division will return value as integer ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Floor division will return value as integer ?

As shown 20//6 gives 3 or 3.0

9th Jul 2016, 5:13 AM
Pavan Gowda
Pavan Gowda - avatar
5 Answers
0
It will return 3 but 20/6 will return 3.0.have a nice day;-)
9th Jul 2016, 7:04 AM
vetarikisa
0
20//6 =3 it is feature of python 3.0 in python 2.7 it was not there
9th Jul 2016, 9:22 AM
jayrajarora2694
jayrajarora2694 - avatar
0
20//6 is integer division, it will only return the integer part of that answer (the amount of times 6 can go into 20). 20/6 will return you the actual answer which would be 3.33333... a//b integer division (floor division) a/b floating point division
9th Jul 2016, 9:35 AM
Gershon Fosu
Gershon Fosu - avatar
0
floor division gives the greatest integer less than or equal to the answer of 20/3, if code is print(20//6) you get output 3 but if the code is print(-20//6) you get the output as -4 it does not just truncate the value of the float( the one you get by just dividing) , it is clear in the case of negative numbers
30th Jul 2016, 4:45 PM
Tom Joseph
Tom Joseph - avatar
- 1
it will return 3.0
9th Jul 2016, 6:09 AM
anup kavari
anup kavari - avatar