Repository navigation
Expand file tree
/
Copy pathsample1.py
More file actions
65 lines (58 loc) · 1.35 KB
/
Copy pathsample1.py
File metadata and controls
65 lines (58 loc) · 1.35 KB
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
61
62
63
64
65
rows = int(input("Masukkan rXc: "))
if rows <=4:
print("Masukan rowsXcolumn minimal adalah '5'")
exit()
# 0 1 2 3 4 5
# 0 *
# 1 * *
# 2 *
# 3 *
# 4 *
# 5 * * * * * *
for i in range(rows):
for j in range(rows):
if i == 1 and j == 0:
print("*", end="")
elif j == rows // 2 or i == rows -1:
print("*", end="")
elif i == rows:
print("*", end="")
else:
print(" ", end="")
print() # pindah new line
# 0 1 2 3 4 5 6
# 0 * * * * *
# 1 *
# 2 * * * * *
# 3 *
# 4 * * * * *
# 5
for i in range(rows):
for j in range(rows):
if i == 0 or i == rows // 2 or i == rows -1:
print("*",end="")
elif i == 1 and j == rows -1:
print("*",end="")
elif i == rows -2 and j == 0:
print("*",end="")
else:
print(" ",end="")
print()
# 0 1 2 3 4 5
# 0 *
# 1 * *
# 2 *
# 3 *
# 4 *
# 5 * * * * * *
for i in range(rows):
for j in range(rows):
if i == 1 and j == 0:
print("*", end="")
elif j == rows // 2 or i == rows -1:
print("*", end="")
elif i == rows:
print("*", end="")
else:
print(" ", end="")
print() # pindah new line