Striped Rectangle
This Program name is Striped Rectangle. Write a Python program to Striped Rectangle
The below link contains Striped Rectangle question, explanation and test cases
https://drive.google.com/file/d/1S7V-_Rle5eyT53qc6RBlwfpo3MzdknUH/view?usp=sharing
We need exact output when the code was run
M = int(input())
N = int(input())
rectangle = []
for row in range(M):
if row % 2 != 0:
rectangle.append(' '.join(['-' for _ in range(N)]))
else:
rectangle.append(' '.join(['+' for _ in range(N)]))
print('\n'.join(rectangle))
Comments
Leave a comment