- 1
module operator explain how 2 is output of this question
print(10//4)
2 odpowiedzi
+ 3
It's floor division operator(//) not modulo(%).
It returns the quotient of a division.
10//4 = (2*4+2)//4 = 2
20//6 = (3*6+2)//6 = 3
...
0
4 * 2 = 8 so 10 // 4 = 2 (floor division)
10-8=2 is the reminder 10%4=2 (modulo opearation)
also floating division.. 10/4=2.5