+ 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

6th Jun 2017, 12:16 PM
HASSAN AIT BIHI
5 Answers
+ 1
[i % j for i in range(1,21) for j in range(1,21)]
6th Jun 2017, 12:29 PM
Madera Oxidada
Madera Oxidada - avatar
+ 1
[print('{0}%{1}={2}'.format(i,j,i % j)) for i in range(1,21) for j in range(1,21)]
6th Jun 2017, 12:50 PM
richard
+ 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])
6th Jun 2017, 1:34 PM
Madera Oxidada
Madera Oxidada - avatar
0
how to make results in line per line please
6th Jun 2017, 12:35 PM
HASSAN AIT BIHI
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
6th Jun 2017, 1:00 PM
HASSAN AIT BIHI