Skip to content

Commit e7ca2a1

Browse files
committed
Print Pattern of letter C
1 parent 9dad1bd commit e7ca2a1

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

patterns/Pattern-C.py

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
__author__ = 'Avinash'
2+
3+
# Python3 program to print alphabet pattern C
4+
5+
# *********
6+
# *
7+
# *
8+
# *
9+
# *
10+
# *
11+
# *
12+
# *********
13+
14+
15+
def print_pattern(n):
16+
# Outer for loop for number of lines(rows)
17+
for i in range(n):
18+
19+
# Inner for loop for logic execution
20+
for j in range(n + 3):
21+
22+
# Print 1st line
23+
if ((i == 0 or
24+
25+
# Print last line
26+
i == n - 1) and
27+
28+
# For more reasonable curve
29+
j > 0 or
30+
31+
# First column
32+
(j == 0 and (i != 0 and i != n - 1))):
33+
print("*", end="")
34+
else:
35+
print(" ", end="")
36+
print()
37+
38+
39+
num = int(input("Enter size: \t"))
40+
41+
if num > 7:
42+
print_pattern(num)
43+
else:
44+
print("Enter a size minimum of 8")

0 commit comments

Comments
 (0)