8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4f15553 commit 306abd0Copy full SHA for 306abd0
patterns/Pattern-H.py
@@ -0,0 +1,38 @@
1
+__author__ = 'Avinash'
2
+
3
4
+# Python3 program to print alphabet pattern H
5
6
+# * *
7
8
9
+# * * * * * *
10
11
12
13
14
15
+def print_pattern(n):
16
+ # Outer for loop for number of rows
17
+ for rows in range(n):
18
19
+ # Inner for loop columns
20
+ for columns in range(n):
21
22
+ # prints first and last column
23
+ if ((columns == 0 or columns == n-1) or
24
+ # prints middle row
25
+ (rows == n // 2)
26
+ ):
27
+ print("*", end=" ")
28
+ else:
29
+ print(" ", end=" ")
30
+ print()
31
32
33
+size = int(input("Enter size: \t"))
34
35
+if size < 8:
36
+ print("Enter a size greater than 8")
37
+else:
38
+ print_pattern(size)
0 commit comments