Created
November 22, 2019 10:11
-
-
Save ooade/7a4e85e67d1b1fb32dfade806acf0e5e to your computer and use it in GitHub Desktop.
Hackerrank Door mat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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