- Prepare
- Python
- Strings
- Designer Door Mat
- Discussions
Designer Door Mat
Designer Door Mat
+ 0 comments x = input()
height, width = x.split() height = int(height) width = int(width) median = (height - 1)/2 + 1 design = '.|..|.'
for _ in range(height): if _ + 1 < median: print(('.|.' + design * _).center(width, "-")) elif _ + 1 == median: print(("WELCOME").center(width, "-")) elif _ + 1 > median: print(('.|.' + design * (height - (_ + 1))).center(width, "-"))
+ 0 comments python with
center()
,ljust()
andrjust
.N,M = list(map(int,input().split(" "))) sequence = lambda y:2*y+1 # 1,3,5,7,9.... width = lambda x:(M-3*sequence(x))//2 # The one side length of "-" character filled. #Top for i in range((N-1)//2): print("".rjust(width(i),"-")+".|."*sequence(i)+"".ljust(width(i),"-")) #Center print("WELCOME".center(M,"-")) #Bottom for i in range((N-1)//2-1,-1,-1): print("".rjust(width(i),"-")+".|."*sequence(i)+"".ljust(width(i),"-"))
+ 0 comments l=list(map(int,input().split())) a=l[0]//2 s='.|.' p=['.|.',] h=0 for i in range(l[0]): if i p.pop() o=h for i in range(h): o=o-1 print(p[o].center(l[1],'-'))
+ 0 comments Enter your code here. Read input from STDIN. Print output to STDOUT
n, m= map(int, input().split()) # n is number of row and m is number of column odd_list=[t for t in range(n-1) if t% 2 !=0] # odd_list '.|.' comes odd number of times but less than number of row def half(lis): p=0 for i in range(n//2): dash=(m-3*lis[p])//2 print("-"(dash) + ".|."(lis[p])+"-"*(dash)) p+=1
upper half
half(odd_list)
middle
print("-"((m-7)//2) + "WELCOME" + "-"((m-7)//2))
lower half
half(odd_list[::-1])
+ 0 comments import math size_1, size_2=map(int, input().split()) list1=[] for k in range(1, size_1): if (k%2!=0): list1.append(k) welcome=math.floor(size_1/2) s='.|.' s2='WELCOME' for i in range(0, welcome): j=(s*list1[i]).center(size_2, '-') k=s2.center(size_2, '-') print(j) print(k) while(welcome): j=(s*list1[welcome-1]).center(size_2, '-') print(j) welcome-=1
Sort 1493 Discussions, By:
Please Login in order to post a comment