Designer Door Mat

  • + 123 comments

    3 lines:

    n, m = map(int,input().split())
    pattern = [('.|.'*(2*i + 1)).center(m, '-') for i in range(n//2)]
    print('\n'.join(pattern + ['WELCOME'.center(m, '-')] + pattern[::-1]))
    
    • + 6 comments

      hey could you explain?

      • + 13 comments

        line 1: srtaightforward.

        There are a couple things to notice.

        • The first is that each line has a set number of repetitions of '.|.', which are centered, and the rest is filled by '-'.

        • The second is that the flag is symmetrical, so if you have the top, you have the bottom by reversing it. You only need to work on n // 2 (n is odd and you need the integer div because the remaining line is the "WELCOME" line).

        line 2: I generate 2\*i + 1 '.|.', center it, and fill the rest with '-'. That's basically the top part of the output.

        line 3: put things together. '\n'.join() should be straightforward. Then, the sequence of strings to join is the pattern described above, the middle 'WELCOME' line, and the pattern reversed.

        Hope that helps!

        • + 22 comments

          [ : :-1] how this works

          • + 1 comment

            str = 'abc'

            print(str[::-1])

            --> 'cba'

            arr = ['a', 'b', 'c']

            print(arr[::-1])

            --> ['c', 'b', 'a']

            • + 0 comments

              here is solution of problem Designer door mat in python 2 and python 3 https://solution.programmingoneonone.com/2020/06/hackerrank-python-designer-door-mat-problem-solution.html

          • + 5 comments
            used for string reverse 
            eg: 
            a="wills"
            a[::-1]
            will give:- "slliw"
             
            
            ---------.|.---------
            ------.|..|..|.------
            ---.|..|..|..|..|.---
            .|..|..|..|..|..|..|.
            -------WELCOME-------
            
            here to print the lower part we need to print the upper region in reverse like this 
            
            .|..|..|..|..|..|..|.
            ---.|..|..|..|..|.---
            ------.|..|..|.------
            ---------.|.---------
            so pattern[ : :-1] is used since
            
            
            pattern = [('.|.'*(2*i + 1)).center(m, '-') for i in range(n//2)]
            whih prints the upper region and pattern[ : :-1]prints the lower region
            
            • + 1 comment

              Beautifully explained.

              • + 0 comments

                Best easy to understand solution is here.

                Hackerrank - Designer Door Mat Solution

            • + 1 comment

              When I used the list comp method shown above, my output resulted in a list of each line printed on a single line. How did you print out each element of the list comprehension on different lines?

              • + 0 comments

                That happens at "\n".join, where each line is joined with a newline added in between.

            • + 0 comments

              okay okay but your output is wrong acc to que but your logic is awesome :>)

            • + 0 comments

              clean explanation , thanks

          • + 0 comments

            It's Used for reversing the string

          • + 0 comments

            it produces the reversed list

          • + 0 comments

            This reverse the string

          • + 0 comments

            The slice statement means start at list length, end at position 0, move with the step -1 (or one step backward).

          • + 0 comments

            [::-1] is used for reversing a string or list

          • + 0 comments

            its been 3 years u may already know this answer. [::-1] will reverse any iterators such as strings, lists, tuples.

          • + 0 comments

            Iterate the pattern list backwards

          • + 0 comments

            That is used to reverse a list, so index 0 becomes index -1, 1 becomes -2, so on and so forth

          • + 0 comments

            Hi,

            This notation means, a list is printed in reverse order.

            >>> a = [ 1 , 2, 3]
            >>> a
            [1, 2, 3]
            >>> a[::-1]
            [3, 2, 1]
            

            So if we can store first half of the data to be printed in a list like:

            ------------.|.------------
            ---------.|..|..|.---------
            ------.|..|..|..|..|.------
            ---.|..|..|..|..|..|..|.---
            

            then we can print the list in reverse order using that notation.

            Hope it is clear now..

          • + 0 comments

            It's slice notation - tells Python to begin at end of string and move backward toward the beginning in steps of -1.

            https://www.w3schools.com/python/python_howto_reverse_string.asp

          • + 0 comments

            it reverses the array

          • + 0 comments

            this will revers the elements of the list

          • + 0 comments

            -1 is the position of the last element.and :: stands for first or initial element.so ::-1 stands for starting from the last element to the first

          • + 0 comments

            its a short trick for reverseing a string

          • + 0 comments

            prints the list in backwards like a = [1,2,3,4] print(a[::-1]) will print [4,3,2,1]

          • + 0 comments

            it will return a reverse string starting from 0 to len(string)-1 and as per the 3rd argument -1 thats why its starts from backward

          • + 0 comments

            this will return the list in reverse order.

          • + 0 comments

            iterates backwards

        • + 0 comments

          A wonderfully elegant solution. Thanks for sharing.

        • + 7 comments

          why have you written pattern in square brackets than closed brackets?

          • + 0 comments

            List comprehension

          • + 0 comments

            dude, [: : -1], the last -1 values show the step size and being -1 this shows that this will work in reverse. As ursan eplained he did the job only for top half and repeated the same work for second half but in reverse

          • + 0 comments

            Pattern is a list

          • + 0 comments

            Here we want pattern to be a "list" so that we can use slicing (pattern[::-1]) afterwards. Hence, the square brackets.

          • + 0 comments

            i think that is list comprehension...

          • + 0 comments

            It's called indexing

          • + 1 comment
            [deleted]
            • + 0 comments

              ['WELCOME'.center(m, '-')] this is a list 'WELCOME'.center(m, '-') this is a string

              we can concatenate list + list + list
              
        • + 2 comments

          2\i + 1 '.|.'

          How does this work?

          • + 1 comment

            its just logic based, 2*i + 1 gives the pattern of 1,3,5,7 for the values of i(0,1,2,3)

            • + 1 comment

              New to python, so why does the '\' character give you multiplication? Would it have been okay to write it as you did instead (e.g. 2*i + 1 rather than 2\i + 1)?

              • + 0 comments

                It's actually "2 * i + 1". "\" is used as an escape character. Like for example "\n" is to be interpreted as linefeed and not just the character n. Here, the backslash is used to be safe; it's not necessary.

          • + 0 comments

            it is better you run the for loop as range(1,n,2).

            a,b = map(int,(input().split())) list = [] for i in range(1,a,2): list.append(('.|.'*i).center(b,'-')) print(*list,sep='\n') print('WELCOME'.center(b,'-')) print(*list[::-1],sep='\n')

        • + 0 comments

          Thanks for the explanation

        • + 0 comments

          WOW. Boy, the brevity of the explanation is refreshing. Thanks bud.

        • + 0 comments

          why (2i + 1)

        • + 0 comments

          thanks for explaining .

        • + 0 comments

          What is 2*i+1? and how does it work?

        • + 0 comments

          awesome :)

        • + 0 comments

          Thanks a lot bro <3<3<3<3

        • + 0 comments

          thank you so much sir :)))

      • + 4 comments
        [deleted]
        • + 3 comments

          Best easy to understand solution is here.

          Hackerrank - Designer Door Mat Solution

          • + 0 comments

            Thank you sir really great

          • + 0 comments

            nice biro

          • + 0 comments

            Thank you !

        • + 0 comments

          here is python problem solution https://programs.programmingoneonone.com/2021/01/hackerrank-designer-door-mat-solution-python.html

        • + 0 comments

          Updated solution is here

          https://www.thecscience.com/2021/06/HackerRank-designer-door-mat-in-python-problem-solution.html

        • + 0 comments

          Easy solution -- https://codecracksol.blogspot.com/2022/03/designer-door-mat.html

      • + 1 comment

        That's too short, really amazing

        • + 0 comments

          Easy solution -- https://codecracksol.blogspot.com/2022/03/designer-door-mat.html

      • + 0 comments

        Best easy to understand solution is here. Hackerrank - Designer Door Mat Solution

      • + 0 comments

        your code code is my love!

      • + 0 comments

        n, m = map(int,input().split())

        please explain

    • + 0 comments

      This is an astonishing code!

    • + 0 comments

      Monster :)))

    • + 0 comments

      utmost geniouslysnesslyfull. Hats off.

    • + 0 comments

      you are something,man..!! this piece of code is a real artwork!

    • + 0 comments

      smart with the pattern[::-1], lol

    • + 2 comments

      in (2*i + 1) .....how does 2 occur?

      • + 0 comments

        The first line has one '.|.' pattern. The second has 3 and so on.

      • + 0 comments

        It's the formula for odd number i.e (2*n+1). In each line odd number of ".|." patterns have been occuring.

    • + 0 comments

      good, very pythonic

    • + 1 comment

      very short but you need some serious python knowledge to grok it. for a beginner question I'd expect to see something a bit more readable. Nice work thou all the same.

      • + 2 comments

        absolutely agree, here is my beginner friendly solution

        N,M = input().split() N = int(N) M = int(M) design1 = "-" design2 = ".|." design3 = "WELCOME" line = [] def print_sy(strt , range_, stp): for i in range(strt,range_,stp): line.append(((M-(2*i+1)*3)//2)*design1 + (2*i+1)*design2 + ((M-(2*i+1)*3)//2)*design1) print(line[i])

        print_sy(0,(N-1)//2,1) print((M-7)//2 *design1 +design3 + (M-7)//2 *design1) print_sy((N-2)//2,-1,-1)

        • + 0 comments

          it dosen't work

    • + 0 comments

      fantastic Solution..!!! Well done buddy..!!!

    • + 0 comments

      Beautiful piece of code @ursan

    • + 0 comments

      nice

    • + 0 comments

      nice code,man!I like it.

    • + 0 comments

      what do you have to import in order to run that code in Python 2? do you know?

    • + 0 comments

      Beautifully simple and elegant!

    • + 0 comments

      ursan,

      Dude, your code blew me away.

      Cheers

    • + 0 comments

      nice

    • + 2 comments

      why we have not user raw_input here to take input for n and m

      • + 1 comment
        [deleted]
        • + 0 comments

          input is allowed in python

      • + 0 comments

        Python 2.x is raw_input, Python 3.x is input. They are the same command to accept "input."

    • + 1 comment

      I tried some code its isnt working, althogh being right. Hemce i tried this one still 5 testcases are failed. Can you help?

      • + 0 comments

        Please post the code that is failing.

    • + 0 comments

      god damn! this is beautiful <3

    • + 0 comments

      I would only offer one alternative. Instead of pattern[::-1] consider list(reversed(pattern))

      Yes it is more verbose, but the intent is clearer. Particularly for developers who have to refactor (or at least understand) that code who also have to work in many languages and don't always catch nuances of each one.

      In data science, particular at companies that favor open source or very large companies with many "standard" products, a data scientist could be using a half dozen languages or more, so in that case "obvious" wins over "specialty".

      That being said, I usually prefer shorter code, so I can easily appreciate arguments for staying with [::-1].

    • [deleted]Challenge Author
      + 0 comments

      very good ty

    • + 0 comments

      nice code

    • + 2 comments
      • n,m=map(int,(input().split()))
      • h=n//2
      • g=2*n+1
      • for i in range(h):
      • print(('.|.'*g).center(m,'-'),"\n")
      • print("WELCOME".center(m,'-'),"\n")
      • for i in range(h,0,-1):
      • print(('.|.'*g).center(m,'-'),"\n")

      this is my code which is printing wrong output . can u explain the difference between your code and mine?

      • + 0 comments

        you should try
        2*i+1

      • + 0 comments

        g must vary as i increase.

    • + 2 comments

      n,m=map(int,(input().split()))

      h=n//2

      for i in range(h): print(('.|.'*(2*n+1)).center(m,'-'),"\n")

      print("WELCOME".center(m,'-'),"\n")

      for i in range(h,0,-1): print(('.|.'*(2*n+1)).center(m,'-'),"\n")

      could you explain why this code would give wrong output?

      • + 0 comments

        @vidyaV i think you should use 2*i+1

      • + 0 comments

        n,m=map(int,(input().split()))

        h=n//2

        for i in range(h): print(('.|.'*(2*i+1)).center(m,'-'))

        print("WELCOME".center(m,'-'))

        for i in range(h,0,-1): print(('.|.'(2(i-1)+1)).center(m,'-'))

    • + 2 comments

      The above solution by @ursan is both witty and hard to read.

      Although longer, this one below is easier to chew (if someone can make this cleaner by substituting the list comprehension with something else that generates the value on demand, that would be fantastic; I'm gonna look into it later):

      def getVals():
          height, width = map(int, input().split())
          assert h % 2 == 1  # make sure the numbers are odd
          assert w == h * 3  # make sure the width is 3 times the height
          return height, width
      
      def designMat(design, message):
          h, w = getVals()
          
          # Top 
          pattern = [i for i in range(1, h, 2)]
          for i in pattern:
              yield '{}'.format(str(design*i)).center(w, '-')
      
          # Middle
          yield '{}'.format(message).center(w, '-')
          
          # Bottom 
          pattern = list(reversed(pattern))
          for i in pattern:
              yield '{}'.format(str(design*i)).center(w, '-')
      
      for line in designMat('.|.', 'WELCOME'):
          print(line)
      
      • + 0 comments

        Thank you! I can actually read this one...lol.

    • + 0 comments

      Just to add on top of the code to explain: Logic: for loop on the Half the Number of lines, and with Integer division(//) Which makes the loop to crete top portion of the MAT For each line we have ODD number of ".|." patterns, so the code (2*i + 1) to make the ".|." created for so many number of times Then this pattern we will CENTER it with a MAX char width of m and filler char of "-", so the code center(m,"-")

      Then for the Welcome line, we print WELCOME with "m" chars at center with fill_char

      For the bottom part of the MAT, we reverse the pattern LIST created

      finally we join all three LISTS and print with "\n" seprated

    • + 2 comments

      I have tried the same code but it is giving error: Traceback (most recent call last): File "solution.py", line 1, in a=[int(i) for i in input().split(" ")] File "", line 1 7 21 ^ SyntaxError: unexpected EOF while parsing. Why?

      • + 0 comments

        I had the same error. We should use raw_input with python 2 and input with Python 3

      • + 0 comments

        because you made some typing error, like

        1. missing : from the end of the for loop
        2. input is a list type in your solution and you can not transfer it to int this way.
    • + 0 comments

      coding at its best!!

    • + 1 comment

      Congratulations for the nice and clean (although not obvious at first) approach. A good pythonic solution for the problem.

    • + 0 comments

      Thank you...before haven't got the idea to read the list from last

    • + 0 comments

      beautifull!!

    • + 1 comment

      Fine piece of art as the akatsuki member deodara would say .

      • + 0 comments

        My Art Is an Explosion

    • + 0 comments

      I am mindblown.

    • + 0 comments

      Awesome!

    • + 1 comment

      can you exaplain me 2*i+1?

      • + 0 comments

        it calculated the times of pattern .|. to be printed, according to index number of line:

        lets take n = 7, so n//2 = 3

        range 3 will be 0,1,2

        for index 0,1,2 you should print .|. 1,3,5 times accordingly

        hence 2*i+1

    • + 0 comments

      how long did it take you to be this good?

    • + 3 comments

      Hlw dear,

      Difference between:

                                                                                              1. n, m = map(int,input().split())   (it's work)
      
                                                                                              2. n = int(input())
                                                                                                       m = int(input())  (but this isn't work)
      
                                          Why Can you explain plz
      
      • + 1 comment

        the format of input is such that both n and m are seperated by spaces and are in one line. When we use n=int(input()) it takes both the inputs say, "a b" as a string and then tries to convert it into integer.. which is invalid because u cannot have an integer as:- 3 4 . Therefore we need to use split function so that the inputs in one line are treated as two different inputs seperated by space and then can be assigned to two variables n,m.

        • + 1 comment

          n, m = map(int,input().split())

          why we use "map and split()"

          • + 0 comments

            split function allows u to break a string into multiple strings based on the specified seperator. by default the seperator is space. now the result that comes after spliting is a list of items and to iterate through the list of items we use map function.

      • + 0 comments

        the format of input is such that both n and m are seperated by spaces and are in one line. When we use n=int(input()) it takes both the inputs say, "a b" as a string and then tries to convert it into integer.. which is invalid because u cannot have an integer as:- 3 4 . Therefore we need to use split function so that the inputs in one line are treated as two different inputs seperated by space and then can be assigned to two variables n,m.

      • + 0 comments

        because of the input sequence ...... if u r giving input by press enter then ur formate is true but in this case hackerank giving its input by pressing space thats why

    • + 0 comments

      very nice code. Thank you

    • + 0 comments

      beautiful :-)

    • + 1 comment

      This message has been deleted

      • + 0 comments

        hahahaha

    • + 0 comments

      Simple and beautiful code

    • + 1 comment

      could u explain about the 1st line ie n, m = map(int,input().split()) what is the use of map function?

      • + 0 comments

        generally map() returns a map object, you can check it by type(map()) , but when map is used with tuple assignment(values on the left) it returns objects. main function of map is to map function with objects and they are being returned to n,m.

    • + 0 comments

      perfectly done, you are the real developer

    • + 0 comments

      Lovely solution, easy to understand and read.

    • + 0 comments

      jeez... Perfection

      Learning Stage

      Upper Part

      t=1

      Upper Half of Mat

      for i in range(1,(N//2)+1,1): print((pipe_print*(t)).center(M,"-")) t=t+2

      Welcome section

      print(welcome_tag.center(M,"-"))

      t=t-2

      Bottom Half of Mat

      for i in range((N//2)+1,1,-1): print((pipe_print*(t)).center(M,"-")) t=t-2

    • + 0 comments

      awesome

    • + 0 comments

      Congratulations

    • + 0 comments

      You're Awesome bro!!!!

    • + 0 comments

      awesome code

    • + 0 comments

      Great solution, thanks.

    • + 0 comments
      pattern = [('.|.'*(2*i + 1)).center(m, '-') for i in range(n//2)]
          how loop is working in this after the center().
      
    • + 0 comments

      xx = input().split()

      n = int(xx[0])

      m = int(xx[1])

      for i in range(n):

       print(('.|.'*(2*i+1)).center(m,'-'))
      

      print("WELCOME".center(m,'-'))

      for i in range(n-1,-1,-1):

      print(('.|.'*(2*i+1)).center(m,'-'))
      
    • + 0 comments

      May I ask how can you use "for i in range..." in this form? inside brackets, after a string.center() and without any colon?

      I had tried to move the for to the beginning of the statement- it didnt work :)

      cheers !

    • + 0 comments

      your solution is amazing

    • + 0 comments

      Beautiful

    • + 0 comments

      @ursan the third line amazed me, i was thinking how to generate the pattern incrementally odd number of times till max value and decrease it afterwards. you are awesome bro. keep going and thanks for sharing.

    • + 0 comments

      Brilliant logic

    • + 0 comments

      Fantastic code.

    • + 0 comments

      Elegant solution sir!!!!!

    • + 0 comments

      Just changing the pattern and using range with step:

      pattern = [('.|.'*i).center(m, '-') for i in range(1,n,2)]
      print('\n'.join(pattern + ['WELCOME'.center(m, '-')] + pattern[::-1]))
      
    • + 0 comments

      great code!

    • + 0 comments

      First solution I submitted was:

          N, M = map(int,input().split())
          for i in range(1,N,2):
              print(('.|.'*i).center(M,'-'))
          print('Welcome'.center(M,'-'))
          for i in range(N-2,0,-2):
              print(('.|.'*i).center(M,'-'))
      

      Then I used list comprehension and my second solution was:

          N, M = map(int,input().split())
          pattern = [('.|.'*i).center(M,'-') for i in range(1,N,2)]
          print('\n'.join(pattern),'\n'+'WELCOME'.center(M,'-'),'\n'+'\n'.join(pattern[::-1]))
      

      Almost identical to your solution but the print was a mess. I saw your comment here and stole that print statement (I don't know why I didn't think of creating one big list then using join to print it effectively, but I have learnt now.)

    • + 0 comments

      Nice Solution. using the iterator in reverse was "lit".

      [::-1]

    • + 1 comment

      sexy ;)

      • + 0 comments

        always...

    • + 0 comments

      very smart!

      However this is a typical example of why I do not like python coding and the now so called "pythonic" way (strangely hackerrank does explicitly favor that kind of syntax though)

      if you read that a year from now, or if someone else reads this without context you ll have a very hard time to understand even what it does, or how to modify it.

      => this is one time throw away kind of code that can t really be maintained

      there is a difference between "short" and "understandable" this code is "short" but not "understandable"

    • + 1 comment

      can anybody explain the working of second line ?

      • + 0 comments

        If you google "list comprehension", you're halfway there.

    • + 0 comments

      ohh man it took me hrs, but your 3 lines code ...is just perfect, great work.

    • + 0 comments

      lindo

    • + 0 comments

      mind blowing :)

    • + 1 comment

      while taking inpur it is still showing an error

      • + 0 comments

        i have done the same thing which u have done but its showing error EOF while parsing n, m = map(int,input().split()) this i have written to take input can u suggest me how could i fix it

    • + 0 comments

      Thanks bro.

    • + 0 comments

      if u can make it 3 lines or 4 lines compard to a few more i doesn't matter in fact this is more cramped and would take alot of time to debug

    • + 0 comments

      Amazing code dude!

    • + 0 comments

      My solution is 20 lines. I am still trying to get used to pyton. Nice job ursan!

    • + 0 comments

      Traceback (most recent call last): File "Solution.py", line 3, in n, m = int,input().split("") File "", line 1 7 21 ^ SyntaxError: unexpected EOF while parsing

    • + 0 comments

      ¡Fantástico!

    • + 0 comments

      this is amazing!!!

    • + 0 comments

      Best Solution man,You are outstanding..!!

    • + 0 comments

      perfect

    • + 0 comments

      can you explain, what different for loop position? your for loop in one line

    • + 0 comments

      wonderfull pal, such a perfect solution.

    • + 0 comments

      I'm spellbound bruh

    • + 0 comments

      Awesome.

    • + 0 comments

      I hate how simple solutions can be. I way overthink these problems and end up with way too many lines. How do I train myself to see the solution like this

    • + 0 comments

      Thanks for sharing.

      elegant solution!!

    • + 0 comments

      well written logic, thank you

    • + 0 comments

      Excellent solution! When I entered the discussion, I haven't been expecting to encounter a such thing!

    • + 0 comments

      Awesome bro.

    • + 1 comment

      very simple solution

      • + 0 comments

        yes

    • + 0 comments

      A genius. The best of Python world (including list comprehension in line #2) crammed into three lines of code :)

      And I learned the string.center() method as well :D

    • [deleted]Challenge Author
      + 0 comments

      Is it normal to get depressed after seeing these like codes?

    • + 0 comments

      amaizngly compact

    • + 0 comments

      This is great

    • + 0 comments

      very nice

    • + 0 comments

      For those of you just learning Python ....if you become a professional don't write code like this. Yes, it is super short and...yes, it is very, very clever.

      But...it is also incomprehensible and difficult to maintain if it were production code. Imagine you needed to modify this to draw a circle pattern instead of a diamond? I often have to scrap short, clever code written like this by another developer because it can't be easily modified, and 10 of 10 of your co-workers will appreciate code they can understand easily and quickly.

    • + 0 comments

      Thank You!! It was very Helpful!!

    • + 0 comments

      N, M = map(int, input().split(" ")) h='.|.' for i in range(N//2): print((h*i).rjust((M//2)-1,'-')+h+(h*i).ljust((M//2)-1,'-')) p='WELCOME' print(p.center(M,'-')) for i in range((N//2)-1,-1,-1): print((h*i).rjust((M//2)-1,'-')+h+(h*i).ljust((M//2)-1,'-'))

    • + 0 comments

      i also used same approch my code is 10 line Haha!

    • + 0 comments

      This is such an amazing short code. Thank you for this.

    • + 0 comments

      It gives Runtime compilation syntax-error !!

    • + 0 comments

      This is just Awesome! amazing work man!!

    • + 0 comments

      smart

    • + 0 comments

      Thanks for sharing!

    • + 0 comments

      Beautifully done!

    • + 0 comments

      This feels beautiful

    • + 0 comments

      Ursan, good job!

    • + 0 comments

      I learned some very cool things from this. Thank you.

    • + 0 comments

      2 Lines:

      n, m = [int(x) for x in input().split()]
      [print("WELCOME".center(m, '-')) if i is n//2 else print((".|."*(n - abs((i * 2) + 1 - n))).center(m, '-')) for i in range(n)]
      
    • + 0 comments

      excellent solution

    • + 0 comments

      n, m = map(int,input().split()) pattern=[str(".|."*(i*2+1)).center(m,"-") for i in range(n)] print(*pattern,sep="\n") print("WELCOME".center(m,"-")) pattern.reverse() print(*pattern,sep="\n")

    • + 0 comments

      the knowledge of a center function changes things!

    • + 0 comments

      Thank you bro!! you just teached me this awesome "center" function from list comprehensions, never hearded about it. beautiful code of yours!

    • + 0 comments
      pattern = [(i * ".|.").center(m, "-") for i in range(1,n,2)]
      print("\n".join(pattern+["WELCOME".center(m,'-')]+pattern[::-1]))
      

      Just simplified the multiplier index

    • + 0 comments

      Bro is the GOAT