8000 Python Program to print pattern of letter H · raun1997/programminginpython.com@6a3177d · GitHub
[go: up one dir, main page]

Skip to content

Commit 6a3177d

Browse files
committed
Python Program to print pattern of letter H
1 parent 306abd0 commit 6a3177d

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

patterns/Pattern-I.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
__author__ = 'Avinash'
2+
3+
4+
# Python3 program to print alphabet pattern I
5+
'''
6+
* * * * * * * * *
7+
*
8+
*
9+
*
10+
*
11+
*
12+
*
13+
*
14+
* * * * * * * * *
15+
'''
16+
17+
18+
def print_pattern(n):
19+
# Outer for loop for number of rows
20+
for rows in range(n):
21+
22+
# Inner for loop columns
23+
for columns in range(n):
24+
25+
# prints first and last row
26+
if ((rows == 0 or rows == n-1) or
27+
# prints middle column
28+
(columns == n // 2)
29+
):
30+
print("*", end=" ")
31+
else:
32+
print(" ", end=" ")
33+
print()
34+
35+
36+
size = int(input("Enter size: \t"))
37+
38+
if size < 8:
39+
print("Enter a size greater than 8")
40+
else:
41+
print_pattern(size)

0 commit comments

Comments
 (0)
0