PROBLEM LINK:
Author: Riddhish Lichade
Tester: Prathamesh Sogale
Editorialist: Ram Agrawal
DIFFICULTY:
SIMPLE
PREREQUISITES:
Loop
PROBLEM:
Chef wants to draw a pattern for his assignment. However, Chef is too busy now, so he has asked you for help. Your task is very simple. Just print the pattern for the corresponding NN value by observing sample test cases.
EXPLANATION:
We are the input as the number of rows N. From the test cases we can observe that number of columns in every row equals (2*N)-1. Every row contains a total of 2*N - 1 asterisks(*) and one space. We just need to find where will the space be located.
SOLUTIONS:
Setter's Solution
from sys import stdin
n=int(stdin.readline())
x = (2 * n) - 1
for r in range(1,n+1):
c=1
while(c<=x):
if(c==n-r+1 or c==r+n-1):
print(' ',end='')
else:
print('*',end='')
c+=1
print()