+ 1

I dont get how 20//6 = 3. Please help me

26th Jul 2017, 12:33 PM
Gareth Hayers
4 Antworten
+ 15
Normal output would be : 3.333333.... if you used "/" but you did a floor division ("//") which means that the 0.3333333 will be dropped.... (everything after decimal point . )
26th Jul 2017, 12:43 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 4
well use this it works on me and print 3 not 3.333333.... print(20//6)
26th Jul 2017, 12:45 PM
Art456
Art456 - avatar
+ 2
// is floor division. It represents how many times the second number occurs in the first number. So, in the example we can see that 6 occurs 3 times in 20. It basically returns the greatest divisor, 3*6 is 18, but 4*6 is 24, which is over 20, so it returns 3, because it us the biggest number that when multiplied by 6 gives a number that's under 20.
26th Jul 2017, 12:49 PM
Vukašin Zeljić
Vukašin Zeljić - avatar
0
Oh okay, than you all for your answers!
26th Jul 2017, 3:41 PM
Gareth Hayers