+ 1
modulo loop
I always get endless loog, who can help me to create modulo loop from 1 to 20 % ( 1 to 20) in python example : 1%1 1%2 1%3 . . 1%20 2%1 2%2 . . . . 3%16 . . . 20%20 the end
5 Answers
+ 1
[i % j for i in range(1,21) for j in range(1,21)]
+ 1
[print('{0}%{1}={2}'.format(i,j,i % j)) for i in range(1,21) for j in range(1,21)]
+ 1
n = 20
rem = [i % j for j in range(1,n+1) for i in range(1,n+1)]
for i in range(n):
print("Modulo",str(i+1)+":")
print(rem[i*n:(i+1)*n])
0
how to make results in line per line please
0
thank you. now how can I make sections
for example
print ("this is the modulo of 1")
.
.
.
print ("this is the modulo of 2")
.
.
etc