+ 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

9th Jul 2019, 7:11 AM
Rupak Barman
Rupak Barman - avatar
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
9th Jul 2019, 9:56 AM
blACk sh4d0w
blACk sh4d0w - avatar
+ 1
Thanks
9th Jul 2019, 9:58 AM
Rupak Barman
Rupak Barman - avatar
0
And what is the question? You don't understand how it works?
9th Jul 2019, 7:19 AM
Airat Abdrakov 🎸
Airat Abdrakov 🎸 - avatar
0
for i in range(1,5): print(i%3) this is question?
9th Jul 2019, 7:20 AM
Rupak Barman
Rupak Barman - avatar
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
9th Jul 2019, 7:29 AM
Airat Abdrakov 🎸
Airat Abdrakov 🎸 - avatar