From afe3f76eca0e4303562bff153773e25ae7afddd2 Mon Sep 17 00:00:00 2001 From: Rishikesh Pandey Date: Fri, 17 Apr 2020 14:17:09 +0530 Subject: [PATCH 1/3] doormat.py --- doormat | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 doormat diff --git a/doormat b/doormat new file mode 100644 index 0000000..1ea03a5 --- /dev/null +++ b/doormat @@ -0,0 +1,42 @@ +""" +Mr. Vincent works in a door mat manufacturing company. One day, he designed a new door mat. +Design specifications are as follows: +1. Size of mat must be NXM. (N is an odd natural number and M is 3 times N.) +2. Design should have 'WELCOME' written in the center. +3. Design pattern should only use '|', '.' and '-' characters. +Sample Designs + Size: 7 x 21 + ---------.|.--------- + ------.|..|..|.------ + ---.|..|..|..|..|.--- + -------WELCOME------- + ---.|..|..|..|..|.--- + ------.|..|..|.------ + ---------.|.--------- + + Size: 11 x 33 + ---------------.|.--------------- + ------------.|..|..|.------------ + ---------.|..|..|..|..|.--------- + ------.|..|..|..|..|..|..|.------ + ---.|..|..|..|..|..|..|..|..|.--- + -------------WELCOME------------- + ---.|..|..|..|..|..|..|..|..|.--- + ------.|..|..|..|..|..|..|.------ + ---------.|..|..|..|..|.--------- + ------------.|..|..|.------------ + ---------------.|.--------------- +----------WELCOME---------- +------------.|.------------ +---------.|..|..|.--------- +------.|..|..|..|..|.------ +---.|..|..|..|..|..|..|.--- +----------WELCOME---------- +---.|..|..|..|..|..|..|.--- +------.|..|..|..|..|.------ +---------.|..|..|.--------- +------------.|.------------ +""" +n, m = input().split() +pattern = [('.|.'*(2*i + 1)).center(int(m), '-') for i in range(int(n)//2)] +print('\n'.join(pattern + ['WELCOME'.center(int(m), '-')] + pattern[::-1])) From 3f9d5fed408f11e09d3ffcc1eb276865505959fc Mon Sep 17 00:00:00 2001 From: Rishikesh Pandey Date: Fri, 17 Apr 2020 14:36:09 +0530 Subject: [PATCH 2/3] doormat.py --- doormat.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/doormat.py b/doormat.py index 093603d..f31aa40 100644 --- a/doormat.py +++ b/doormat.py @@ -45,9 +45,6 @@ """ -N, M = map(int,raw_input().split()) # More than 6 lines of code will result in 0 score. Blank lines are not counted. -for i in xrange(0,N/2): - print ('.|.'*i).rjust((M-2)/2,'-')+'.|.'+('.|.'*i).ljust((M-2)/2,'-') -print 'WELCOME'.center(M,'-') -for i in reversed(xrange(0,N/2)): - print ('.|.'*i).rjust((M-2)/2,'-')+'.|.'+('.|.'*i).ljust((M-2)/2,'-') +n, m = input().split() +pattern = [('.|.'*(2*i + 1)).center(int(m), '-') for i in range(int(n)//2)] +print('\n'.join(pattern + ['WELCOME'.center(int(m), '-')] + pattern[::-1])) From e2f08fae8998a82167ef761ea9301273c5a1fc03 Mon Sep 17 00:00:00 2001 From: Rishikesh Pandey Date: Fri, 17 Apr 2020 14:59:21 +0530 Subject: [PATCH 3/3] Delete doormat --- doormat | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 doormat diff --git a/doormat b/doormat deleted file mode 100644 index 1ea03a5..0000000 --- a/doormat +++ /dev/null @@ -1,42 +0,0 @@ -""" -Mr. Vincent works in a door mat manufacturing company. One day, he designed a new door mat. -Design specifications are as follows: -1. Size of mat must be NXM. (N is an odd natural number and M is 3 times N.) -2. Design should have 'WELCOME' written in the center. -3. Design pattern should only use '|', '.' and '-' characters. -Sample Designs - Size: 7 x 21 - ---------.|.--------- - ------.|..|..|.------ - ---.|..|..|..|..|.--- - -------WELCOME------- - ---.|..|..|..|..|.--- - ------.|..|..|.------ - ---------.|.--------- - - Size: 11 x 33 - ---------------.|.--------------- - ------------.|..|..|.------------ - ---------.|..|..|..|..|.--------- - ------.|..|..|..|..|..|..|.------ - ---.|..|..|..|..|..|..|..|..|.--- - -------------WELCOME------------- - ---.|..|..|..|..|..|..|..|..|.--- - ------.|..|..|..|..|..|..|.------ - ---------.|..|..|..|..|.--------- - ------------.|..|..|.------------ - ---------------.|.--------------- -----------WELCOME---------- -------------.|.------------ ----------.|..|..|.--------- -------.|..|..|..|..|.------ ----.|..|..|..|..|..|..|.--- -----------WELCOME---------- ----.|..|..|..|..|..|..|.--- -------.|..|..|..|..|.------ ----------.|..|..|.--------- -------------.|.------------ -""" -n, m = input().split() -pattern = [('.|.'*(2*i + 1)).center(int(m), '-') for i in range(int(n)//2)] -print('\n'.join(pattern + ['WELCOME'.center(int(m), '-')] + pattern[::-1]))