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