Answer to Question #329845 in Python for ram

Question #329845

Get the input from the user for the number of rows and columns.


Print 0 in the row one.


Print 1 in the row two.


Case= Test 1

input=

5

5



output=

00000

11111

00000

11111

00000  


1
Expert's answer
2022-04-17T13:53:33-0400
m = int(input("Enter number of lines: "))
n = int(input("Enter number of columns: "))

for i in range(m):
    for j in range(n):
        if (i == 0) or (i % 2 == 0):
            print('0', end='')
        else:
            print('1', end='')
    print()

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