-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pattern.py
88 lines (53 loc) · 1.31 KB
/
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
n = int(input("Enter the number of rows : "))
# l = ["A" , "B" , "C" , "D" , "E" , "F" , "G" ,"H" , "I"]
# for i in range(0 , n):
# for j in range(0,i+1):
# print(l[i] , end="")
# print("")
for i in range(0 , n):
for j in range(0 , n-i):
print(" ", end="")
print("*",end="")
for j in range ( 0 , 2*i-1 ):
if(i < 1):
break
print(" ",end="")
if(not(i<1)):
print("*")
else:
print("")
for i in range(0 , n+1):
for j in range(0 , i):
print(" ", end="")
print("*",end="")
for j in range(0 , 2*(n-i)-1):
if(i==n):
break
else:
print(" ",end="")
if(i==n):
print("")
else:
print("*")
# for i in range(1,n+1):
# if(i%2 ==0 ):
# print(" *")
# else:
# print("* ")
# Pyramid
# for i in range ( 1 , n + 1 ):
# for j in range(0 , i):
# print(" ",end=""
# for j in range( 0 , n-i+1):
# print("*",end=" ")
# print("\n",end="")
# 12345 pattern
# for i in range(1,n+1):
# for j in range(1 , i+1):
# print(j ,end= "")
# print("")
#straight pyramid
# for i in range (1,n+1):
# for j in range( 0 , i):
# print("*",end=" ")
# print("\n",end="")