Q:

Create a simple number pattern in python? 

I'm trying to get this number pattern 
0
01
012
0123
01234
012345
0123456
01234567
012345670
0123456701

But I can't figure out how to reset the digits when I reach over 8 in my function.  There is my code:
def afficherPatron(n):
triangle = ''

for i in range(0, n):
    triangle = triangle + (str(i))
    print(triangle)
    i+=1

Thanks in advance to all of you!  

A:

Use i mod 8 (i%8) because it is cyclic 0 to 7 :
for i in range(0, n):
    triangle = triangle + str(i%8)
    print(triangle)

