Star Pattern
Print the following pattern
Pattern for N = 4

The dots represent spaces.
Input Format :
Output Format :
Constraints :
Sample Input 1 :
Sample Output 1 :
Sample Input 2 :
Sample Output 2 :
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Read input as specified in the question. | |
## Print output as specified in the question. | |
num=int(input()) | |
i=1 | |
while num>=i: | |
spaces=1 | |
while spaces<=(num-i): | |
print(" ",end="") | |
spaces=spaces+1 | |
k=i | |
while k>=1: | |
print("*",end="") | |
k=k-1 | |
j=2 | |
while j<=i: | |
print("*",end="") | |
j=j+1 | |
print() | |
i += 1 |
Comments
Post a Comment
Please give us your valuable feedback