-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstar patterns.py
More file actions
72 lines (71 loc) · 2.23 KB
/
star patterns.py
File metadata and controls
72 lines (71 loc) · 2.23 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
66
67
68
69
70
71
72
n=int(input("eter the input"))#up star
for row in range(n):
for col in range(n):
if(col==0 or row==n-1 or row==col):
print("*",end="")
else:
print(end=" ")
print()
#------------------------------------------------------------------------------
n=int(input("enter the input"))#down star
for row in range(n):
for col in range(n):
if(row==0 or col==n-1 or row==col):
print("*",end="")
else:
print(end=" ")
print()
#------------------------------------------------------------------------------
print("-----------hollow triangle-------------")
for row in range(1,5):
for col in range(1,8):
if row==4 or row+col==5 or col-row==3:
print("*",end="")
else:
print(end=" ")
print()
print("-----------equal triangle-------------")
n=int(input("enter the rows:"))
k=2
for row in range(1,n+1):
for col in range(1,2*n):
if row+col==n+1 or col-row==n-1:
print("*",end="")
elif row==n and col!=k:
print("*",end="")
k=k+2
else:
print(end=" ")
print()
#------------------------------------------------------------------------------
n=int(input("enter the rows"))#while loop triangle
row=0
while row<n:
star=row+1
while star>0:
print("*",end="")
star=star-1
row=row+1
print()
#------------------------------------------------------------------------------
num=int(input("enter the rows:"))#while loop pyramid
row=0
while row<num:
space=num-row-1
while space>0:
print(end=" ")
space=space-1
star=row+1
while star>0:
print("*",end=" ")
star=star-1
row=row+1
print()
#------------------------------------------------------------------------------
for row in range(5):#diamond program
for col in range(5):
if row+col==2 or row+col==6 or row-col==2 or col-row==2:
print("*",end="")
else:
print(end=" ")
print()