Answer to Question #237166 in Python for umesh

Question #237166

Striped Rectangle

Given an integer number

M, N as input. Write a program to print a striped rectangular pattern of M rows and N columns using (+ and -) character.Input

The first line of input is an integer

M. The second line of input is an integer N.Explanation

In the given example the striped rectangular pattern of

7 rows and 5 columns. Therefore, the output should be 


1
Expert's answer
2021-09-16T02:32:03-0400
M=int(input())
N=int(input())


for i in range(M):
    for j in range(N):
        if (i%2==0):
            print("+",end=" ")
        else:
            print("-",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