-
Notifications
You must be signed in to change notification settings - Fork 1
/
36.PY
60 lines (44 loc) · 1.08 KB
/
36.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
52
53
54
55
56
57
58
59
60
# * * * *
# * *
# * * * * *
# * *
# * * * *
row = 5
col = 5
for i in range(row):
for j in range(col):
# checking if i < row/2
if(i < row // 2):
# checking if j<col/2
if (j < col // 2):
# print '*' if j=0
if (j == 0):
print("*", end = "")
# else print space
else:
print(" ", end = " ")
# check if j=col/2
elif (j == col // 2):
print(" *", end = "")
else:
# if i=0 then first row will have '*'
if (i == 0):
print(" *", end = "")
elif (i == row // 2):
print("* ", end = "")
else:
# middle column and last column will
# have '*' after i > row/2
if (j == col // 2 or j == col - 1):
print("* ", end = "")
# last row
elif (i == row - 1):
# last row will be have '*' if
# j <= col/2 or if it is last column
if (j <= col // 2 or j == col - 1):
print("* ", end = "")
else:
print(" ", end = " ")
else:
print(" ", end = " ")
print()