Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

doormat pattern

n,m = input().split()
n = int(n)
m = int(m)
#printing first half
for i in range(n//2):
    t = int((2*i)+1)
    print(('.|.'*t).center(m, '-'))
#printing middle line
print('WELCOME'.center(m,'-'))
#printing last half
for i in reversed(range(n//2)):
    t = int((2*i)+1)
    print(('.|.'*t).center(m, '-'))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #doormat #pattern
ADD COMMENT
Topic
Name
5+9 =