8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f90295a commit c947414Copy full SHA for c947414
patterns/Pattern-P.py
@@ -0,0 +1,47 @@
1
+__author__ = 'Avinash'
2
+
3
4
+# Python3 program to print alphabet pattern P
5
6
+# * * * * * * * * * *
7
+# * *
8
9
10
11
12
+# * * * * * * * * * * *
13
+# *
14
15
16
17
18
+def print_pattern(n):
19
+ for row in range(n):
20
+ for column in range(n):
21
+ if (
22
23
+ # first row
24
+ (row == 0 and (column != 0 and column != n-1)) or
25
26
+ # middle row
27
+ (row == n//2 and column != n-1) or
28
29
+ # first column
30
+ (column == 0 and (row !=0 and row != n-1)) or
31
32
+ # last column
33
+ (column == n-1 and row < n//2 and row != 0)
34
+ ):
35
+ print("*", end=" ")
36
+ else:
37
+ print(" ", end=" ")
38
+ print()
39
40
41
+size = int(input("Enter a size:\t"))
42
43
+if size < 8:
44
+ print("Enter a size minumin of 8")
45
+else:
46
+ print_pattern(size)
47
0 commit comments