Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

doormat pattern python

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 #python
ADD COMMENT
Topic
Name
7+6 =