There was an error while loading. Please reload this page.
1 parent 9a2a6a0 commit 4c631f0Copy full SHA for 4c631f0
1 file changed
patterns/Pattern-U.py
@@ -0,0 +1,39 @@
1
+__author__ = 'Avinash'
2
+
3
4
+# Python3 program to print alphabet pattern U
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
+ # first column
20
+ (column == 0 and row != n-1) or
21
22
+ # last column
23
+ (column == n-1 and row != n-1) or
24
25
+ # last row
26
+ (row == n-1 and column != 0 and column != n-1)
27
+ ):
28
+ print("*", end=" ")
29
+ else:
30
+ print(" ", end=" ")
31
+ print()
32
33
34
+size = int(input("Enter any size: \t"))
35
36
+if size < 8:
37
+ print("Enter a size minimum of 8")
38
+else:
39
+ print_pattern(size)
0 commit comments