18 Answers
New Answer// is a floor division operator Remove the digits after the decimal points after division 20/6 = 3.333... 20//6 = 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/Python/2273/?ref=app
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....
You are asking for only the whole number in the result so the ans is 3 instaed of 3.3333
Result is : how many times 20 is divided by 6. = 3 Trunkates reminder.. Basic math 20 by 6 // Floor (Integer) division operator in python *....
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
// 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!
Compare 20 // 6 = 3 3 * 6 = 18 20 - 18 = 2 20 % 6 = 2 2 / 6 = 0.333333333 20 / 6 = 3.333333
Sunad Magdum % is called modulus operator , it returns remainder after division 20%6=2 6 ) 20 (3 -18 ----------------- 2 ----------------- Hope it will help you ๐
/ - 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
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message