- Mat size must be N x M. (N is an odd natural number, and M is 3 times N.)
- The design should have 'WELCOME' written in the center.
- The design pattern should only use |,. and - characters.
Input Format:
- A single line containing the space-separated values of N and M.
Constraints:
- 5 < N < 101
- 15 < M < 303
Output Format:
- Output the design pattern.
Sample Input:
9 27
Sample Output:Solution:
# Enter your code here. Read input from STDIN. Print output to STDOUT
n,m= map(int,input().split())
center = n//2
count = -1
for i in range(0,n):
if i == center:
count += 2
pattern = 'WELCOME'
print(pattern.center(m,'-'))
elif i < center:
count += 2
pattern = '.|.' * count
print(pattern.center(m,'-'))
elif i > center:
count -= 2
pattern = '.|.' * count
print(pattern.center(m,'-'))
No comments:
Post a Comment