10000 Pattern of Letter Y · avinashn/programminginpython.com@543c63c · GitHub
[go: up one dir, main page]

Skip to content

Commit 543c63c

Browse files
committed
Pattern of Letter Y
1 parent 19ca856 commit 543c63c

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

patterns/Pattern-Y.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
__author__ = 'Avinash'
2+
3+
4+
# Python3 program to print alphabet pattern Y
5+
6+
# * *
7+
# * *
8+
# * *
9+
# * *
10+
# * *
11+
# * *
12+
# *
13+
# *
14+
# *
15+
# *
16+
# *
17+
# *
18+
19+
def print_pattern(n):
20+
for row in range(n):
21+
for column in range(n):
22+
if(
23+
# right slanting line
24+
(row + column == n-1) or
25+
26+
# left slanting line half
27+
(row == column and row < n/2)
28+
):
29+
print("* ", end=" ")
30+
else:
31+
print(" ", end=" ")
32+
print()
33+
34+
35+
size = int(input("Enter any size: \t"))
36+
37+
if size < 8:
38+
print("Enter a number minimum of 8")
39+
else:
40+
print_pattern(size)

0 commit comments

Comments
 (0)
0