-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathStar_shape.py
More file actions
42 lines (37 loc) · 833 Bytes
/
Copy pathStar_shape.py
File metadata and controls
42 lines (37 loc) · 833 Bytes
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
#how to print following pattern in one line
'''
size: 20
*
* *
* *
* *
* *
*****************************
* * * *
* * * *
* * * *
** **
** **
* * * *
* * * *
* * * *
*****************************
* *
* *
* *
* *
*
'''
#Taking size of star
n = int(input('Enter the size of star: '))+8
#pattern
pat = '*'
#one fourth / quad
h = n//4
#parameters
up = n-h-1
#printing pattern
for i in range(n):
for j in range(2*up+1):
print('*' if (i in (h, up)) or ((i+j) in (up, up+n-1)) or ((j-i) in (up, -h)) else ' ' , end='')
print()