Answer to Question #282566 in Python for Teja

Question #282566

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

1
Expert's answer
2021-12-27T08:41:37-0500
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)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS