Answer to Question #337600 in Python for Sudheer

Question #337600

How to print square pattern like this.



When input=4.



1 2 3 4



5 6 7 8



9 10 11 12



13 14 15 16




1
Expert's answer
2022-05-06T14:21:01-0400
a = int(input())

count = 1

for i in range(a):

lst = [str(i) for i in range(count, count + a)]

count += a

print(" ".join(lst))

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