Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions solutions/punched-cards/punched_cards.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
def punchCard(R, C):

for r in range(R * 2 + 1):
for c in range(C * 2 + 1):
if r < 2 and c < 2:
print(".", end="")
else:
if r % 2 == 0:
if c % 2 == 0:
print("+", end="")
else:
print("-", end="")
else:
if c % 2 == 0:
print("|", end="")
else:
print(".", end="")
print("")


# Read the number of test cases.
T = int(input())
# Loop over the number of test cases.
for test_no in range(1, T + 1):
# get rows and columns
(R, C) = tuple(map(int, input().split()))
print("Case #%d:" % test_no)
punchCard(R, C)