-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStar Pattern.py
52 lines (39 loc) · 832 Bytes
/
Star Pattern.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
'''
Problem statement
Print the following pattern
Pattern for N = 4
Hint
As taught in the video, you just have to modify the code so that instead of printing numbers, it should output stars ('*').
The dots represent spaces.
Detailed explanation ( Input/output format, Notes, Images )
Constraints :
0 <= N <= 50
Sample Input 1 :
3
Sample Output 1 :
*
***
*****
Sample Input 2 :
4
Sample Output 2 :
*
***
*****
*******
'''
from math import *
from collections import *
from sys import *
from os import *
## Read input as specified in the question.
n = int(input())
## Print output as specified in the question.
for i in range(1,n+1):
for s in range(n-i):
print(" ",end="")
for j in range(1,i+1):
print("*", end="")
for k in range(1,i):
print("*" ,end="")
print()