We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. Python
  3. Strings
  4. Designer Door Mat
  5. Discussions

Designer Door Mat

Problem
Submissions
Leaderboard
Discussions
Editorial

Sort 1280 Discussions, By:

recency

Please Login in order to post a comment

  • rjdayalani
    4 hours ago+ 0 comments

    Enter your code here. Read input from STDIN. Print output to STDOUT

    design pattern (x by x multiply 3) 5 by 15, 7 by 21 , 9 by 27

    user_in=list(input().split()) size=int(user_in[0]) range_len = size*3 logo='WELCOME' design_dash = '---' design_mix = '.|.'

    dash_print = (size//2)

    top pattern print

    j=1 for i in range(size//2): print(design_dash*(dash_print-i) + design_mix*j + design_dash*(dash_print-i)) j+=2

    center 'welcome' line

    print(design_dash*(((range_len-7)//6))+'-' + logo + design_dash*(((range_len-7)//6))+'-')

    bottom pattern print

    j=(j-2) for i in range((size//2),0,-1): print(design_dash*(dash_print-(i-1)) + design_mix*j + design_dash*(dash_print-(i-1))) j-=2

    0|
    Permalink
  • sakib786110
    18 hours ago+ 0 comments
    N,M = input().split(" ")
    N = int(N)
    M = int(M)
    count = 0
    l1 = []
    for i in range(0,int((N-1)/6)):
        for j in range(0,int(M),3):
            count+=1                              
            if count%2==0 and count<int(N):
                l1.append("-"*int((M-j)/2)+".|."*int(count-1)+"-"*int((M-j)/2)) 
    
    for i in range(0,len(l1)):
        print(l1[i])
                
    print(("-"*int((M-7)/2))+"WELCOME"+("-"*int((M-7)/2)))                        #N
    
    for i in range(len(l1),0,-1):
        print(l1[i-1])
    
    0|
    Permalink
  • Amphibee
    1 day ago+ 0 comments
    def doorMat(n, m):
        result = ""
    
        if n % 2 == 0:
            return "Error: N is not natural odd number"
    
        if m / 3 != n:
            return "Error: M is not 3 times of N"
    
        mid_row = n // 2
        mid_col = m // 2
    
        def pattern_creator(row):
            sep = "|.."
            mid_symbol = "|"
    
            half_pat_minus_mid = "." + (row * sep)
            dashes = (mid_col - len(half_pat_minus_mid)) * "-"
    
            temp_result = (
                dashes + half_pat_minus_mid + mid_symbol + half_pat_minus_mid[::-1] + dashes
            )
            return temp_result
    
        for row in range(mid_row):
            result += "\n" + pattern_creator(row)
    
        dashes = (m - 7) // 2 * "-"
        temp_result = dashes + "WELCOME" + dashes
    
        result += "\n" + temp_result
    
        for row in range(mid_row - 1, -1, -1):
            result += "\n" + pattern_creator(row)
    
        print(result[1:])
    
    
    if __name__ == "__main__":
        inp = list(input().split(" "))
        n = int(inp[0])
        m = int(inp[1])
    
        doorMat(n, m)
    
    0|
    Permalink
  • user33b100001
    2 days ago+ 0 comments
    s1,s2 = input().split()
    
    x='WELCOME'
    y='---'
    z='.|.'
    size = ((int(s1)-1)//2)
    top=size
    for i in range(size):
        print(y*(top-i)+((2*(i+1))-1)*(z)+(y*(top-i)))
    print(x.center(int(s2),'-'))
    for i in range(size):
        print(y*(i+1)+((2*(top-i))-1)*(z)+(y*(i+1)))
    
    0|
    Permalink
  • user33b100001
    2 days ago+ 0 comments
    s1,s2 = input().split()
    
    x='WELCOME'
    y='---'
    z='.|.'
    size = ((int(s1)-1)//2)
    top=size
    for i in range(size):
        print(y*(top-i)+((2*(i+1))-1)*(z)+(y*(top-i)))
    print(x.center(int(s2),'-'))
    for i in range(size):
        print(y*(i+1)+((2*(top-i))-1)*(z)+(y*(i+1)))
    
    0|
    Permalink
Load more conversations

Need Help?


View editorial
View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy