8000 Pattern of Letter U · mafnan1/programminginpython.com@4c631f0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4c631f0

Browse files
committed
Pattern of Letter U
1 parent 9a2a6a0 commit 4c631f0

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

patterns/Pattern-U.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)
0