Please explain 20 // 6 | Sololearn: Learn to code for FREE!

+2

Please explain 20 // 6

9/8/2020 4:26:15 PM

Sunad Magdum

18 Answers

New Answer

+3

// is a floor division operator Remove the digits after the decimal points after division 20/6 = 3.333... 20//6 = 3

+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

+3

Floor division is like integer division.

+2

@Vadivelan It redirects me to https://www.sololearn.com/pagenotfound

+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....

+2

It is equivalent to rounded integer division using floor and ceil functions ๐Ÿค–

+2

You are asking for only the whole number in the result so the ans is 3 instaed of 3.3333

+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 *....

+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

+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!

+1

Compare 20 // 6 = 3 3 * 6 = 18 20 - 18 = 2 20 % 6 = 2 2 / 6 = 0.333333333 20 / 6 = 3.333333

0

Erich Buelow How many digits I have to remove??

0

Sunad Magdum All the digits after decimal , you have to remove

0

โ™คโ™ขโ˜ž ๐Š๐ข๐ข๐›๐จ ๐†๐ก๐š๐ฒ๐š๐ฅ โ˜œโ™ขโ™ค Plz explain 20 % 6

0

Sunad Magdum % is called modulus operator , it returns remainder after division 20%6=2 6 ) 20 (3 -18 ----------------- 2 ----------------- Hope it will help you ๐Ÿ™‚

0

floor division only get int values

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

-1

Explain 20%6