+ 1
in python 3, i don't understand this question please explain me question in description?
for i in range(1,5): print(i%3) output is 1 2 0 1
5 Respuestas
+ 4
Modulo operator % returns the remainder of a division.
If two numbers are divided equally, their remainder will be zero e.g 2 / 2 = 1 but remainder is 0.
First iteration
i = 1
1 % 3 = 1
Second iteration
i = 2
2 % 3 = 2
Third iteration
i = 3
3 % 3 = 0
Fourth iteration
i = 4
4 % 3 = 1
+ 1
Thanks
0
And what is the question? You don't understand how it works?
0
for i in range(1,5):
print(i%3)
this is question?
0
Nope. This not a question... But sololearn questions write upper and you may not see it. In other way you can guess this question by see length answer space