Simple question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Simple question

print(5 % 2) gives u 1 which is the remainder ok i understand that but how did print(2 % 5) gives u 2

25th Dec 2017, 5:33 PM
stephen haokip
stephen haokip - avatar
2 Answers
+ 14
5 cannot divide 2 at all so it just returns it untouched. (it's the remainder since it gets divided 0 times) Tip: a<b a%b=a a=b a%b=0
25th Dec 2017, 5:37 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 5
gotcha thank you
26th Dec 2017, 3:12 AM
stephen haokip
stephen haokip - avatar