Skip to content

Commit dec6057

Browse files
Adding Patterns
1 parent dd6eac9 commit dec6057

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

patterns.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,42 @@
114114
r = r + 1
115115
c = c + 1
116116
print("")
117+
118+
'''
119+
* * * * * * * * * *
120+
* *
121+
* *
122+
* *
123+
* *
124+
* *
125+
* *
126+
* *
127+
* *
128+
* * * * * * * * * *
129+
'''
130+
no_of_rows = int(input("Input the number of rows required for the pattern : "))
131+
print()
132+
for i in range(no_of_rows):
133+
for j in range(no_of_rows):
134+
if(i == 0 or i == no_of_rows - 1 or j==0 or j == no_of_rows -1):
135+
print(' * ', end = '')
136+
else:
137+
print(' ', end = '')
138+
print()
139+
140+
'''
141+
* * * * *
142+
* * * *
143+
* * *
144+
* * * *
145+
* * * * *
146+
'''
147+
no_of_rows = int(input("Input the number of rows required for the pattern : "))
148+
print()
149+
for i in range(no_of_rows):
150+
for j in range(no_of_rows):
151+
if(i==j or i == 0 or i == no_of_rows - 1 or j == (no_of_rows - 1 - i) or j==0 or j == no_of_rows -1):
152+
print(' * ', end = '')
153+
else:
154+
print(' ', end = '')
155+
print()

0 commit comments

Comments
 (0)