Number pattern:
input: 4
Output should :
1 2 3 4 17 18 19 20
5 6 7 14 15 16
8 9 12 13
10 11
def pattern(n):
#starting number for pattern
num = 1
#for loop for number raw
for i in range(0, n):
num = 1
for j in range(0, i + 1):
print(num, end=" ")
num = num + 1
print("\r")
#here you need to add your number for printing
n = 6
pattern(n)
Comments
Leave a comment