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