Please explain 20 // 6 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Please explain 20 // 6

8th Sep 2020, 4:26 PM
Sunad Magdum
Sunad Magdum - avatar
17 Answers
+ 3
// is a floor division operator Remove the digits after the decimal points after division 20/6 = 3.333... 20//6 = 3
8th Sep 2020, 4:33 PM
Erich Buelow
Erich Buelow - avatar
+ 3
// is floor divion It return quotient of Division. Here 20//6 6 will be 3 times in 20. So output will be 3. https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2273/?ref=app
8th Sep 2020, 4:29 PM
Vadivelan
+ 3
Floor division is like integer division.
8th Sep 2020, 10:16 PM
Sonic
Sonic - avatar
+ 2
@Vadivelan It redirects me to https://www.sololearn.com/pagenotfound
8th Sep 2020, 4:35 PM
Erich Buelow
Erich Buelow - avatar
+ 2
Sunad Magdum You get it automatically if you do it by program... It is Integer equalent of total result (of 3.3333 => 3). It gives dividend, to get reminder use % operator. 20 // 6 = 3 because 3*6=18, =>Floor or Integer division. 20 / 6 = 3.33333.... => decimal division 20 % 6 = 2. Because 3*6=18, & 20-18 =2 =>modular division Erich Buelow may you not completed that lesson so you can't see.. I think the questioner also can't see so that's why I added explanation....
8th Sep 2020, 4:55 PM
Jayakrishna 🇮🇳
+ 2
It is equivalent to rounded integer division using floor and ceil functions 🤖
10th Sep 2020, 6:21 AM
Sanjay Kamath
Sanjay Kamath - avatar
+ 2
You are asking for only the whole number in the result so the ans is 3 instaed of 3.3333
10th Sep 2020, 12:41 PM
Abdul - Razaq
+ 1
Result is : how many times 20 is divided by 6. = 3 Trunkates reminder.. Basic math 20 by 6 // Floor (Integer) division operator in python *....
8th Sep 2020, 4:31 PM
Jayakrishna 🇮🇳
+ 1
It is not enough to just remove the digits after the decimal point after division by the way. I have written an in-depth explanation of floor division in my linked code using that example. https://code.sololearn.com/cV9AXDn5asB5/?ref=app
8th Sep 2020, 8:22 PM
Njeri
Njeri - avatar
+ 1
// is a floor division operator so: 20/6 = 3.333... While: 20//6=3 See! It rounds off to the bottom(floor)! So, it removes the decimal!
10th Sep 2020, 7:54 AM
Query
Query - avatar
+ 1
Compare 20 // 6 = 3 3 * 6 = 18 20 - 18 = 2 20 % 6 = 2 2 / 6 = 0.333333333 20 / 6 = 3.333333
26th Sep 2020, 1:16 AM
Polo Maldonado Martínez
Polo Maldonado Martínez - avatar
+ 1
It just mean to return the remainder after 20 has been divided by 6 Which then in this case would be "2"
6th Dec 2022, 6:42 AM
Abdul - Razaq
0
Erich Buelow How many digits I have to remove??
8th Sep 2020, 4:39 PM
Sunad Magdum
Sunad Magdum - avatar
8th Sep 2020, 4:50 PM
Sunad Magdum
Sunad Magdum - avatar
0
floor division only get int values
10th Sep 2020, 4:56 AM
swetav savarn
swetav savarn - avatar
0
/ - refers to actual division. Eg - 20/6 = 3.3333(quotient) Answer here is: 3.3333 where as, // - refers to floor division. Eg - 20/6 = 3(quotient) Answer here is: 3
10th Sep 2020, 12:38 PM
AMAN GUPTA
AMAN GUPTA - avatar
- 1
Explain 20%6
24th Mar 2021, 4:14 AM
bharath sarvala
bharath sarvala - avatar