Skip to content

Commit 8f851c6

Browse files
committed
Pattern of Letter Z
1 parent 543c63c commit 8f851c6

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

patterns/Pattern-Z.py

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
__author__ = 'Avinash'
2+
3+
# Python3 program to print alphabet pattern Z
4+
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+
if(
21+
# first row
22+
(row == 0) or
23+
24+
# last row
25+
(row == n-1) or
26+
27+
# slanting line
28+
(row+column == n-1)
29+
):
30+
print("*", end=" ")
31+
else:
32+
print(" ", end=" ")
33+
print()
34+
35+
36+
size = int(input("Enter any size: \t"))
37+
38+
if size < 8:
39+
print("Enter a size minimum of 8")
40+
else:
41+
print_pattern(size)

0 commit comments

Comments
 (0)