Answer to Question #348836 in Python for Nikhil

Question #348836

write a program to print numbers from 1 to N in each row forming a square pattern of N rows and M columns


1
Expert's answer
2022-06-07T17:38:31-0400
def main():
    try:
        t = int(input('Enter a number: '))
        n = int(input('Number of columns:'))
        for i in range(1, t + 1):
            print(str(i) * n)
    except ValueError:
        print('Numbers only')
        main()
main()

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