8000 Pattern of Letter X · raun1997/programminginpython.com@19ca856 · GitHub
[go: up one dir, main page]

Skip to content

Commit 19ca856

Browse files
committed
Pattern of Letter X
1 parent ebf3c2b commit 19ca856

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

patterns/Pattern-X.py

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

0 commit comments

Comments
 (0)
0