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