Skip to content

Instantly share code, notes, and snippets.

@ooade
Created November 22, 2019 10:11
Show Gist options
  • Save ooade/7a4e85e67d1b1fb32dfade806acf0e5e to your computer and use it in GitHub Desktop.
Save ooade/7a4e85e67d1b1fb32dfade806acf0e5e to your computer and use it in GitHub Desktop.
Hackerrank Door mat
# Enter your code here. Read input from STDIN. Print output to STDOUT
n, m = input().split()
n = int(n)
m = int(m)
extra = 0
reversed_iteration = False
tracker = []
for i in range(0, n):
if int(n/2) == i:
print('WELCOME'.center(m, '-'))
reversed_iteration = True
else:
if reversed_iteration:
print(tracker[n - i - 1])
else:
decoration = '.|.' * (i + extra + 1)
print(decoration.center(m, '-'))
tracker.append(decoration.center(m, '-'))
extra += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment