-
-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathPattern-D.py
43 lines (33 loc) · 798 Bytes
/
Pattern-D.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
__author__ = 'Avinash'
# Python3 program to print alphabet pattern D
# * * * * *
# * *
# * *
# * *
# * *
# * *
# * *
# * * * * *
def print_pattern(n):
# Outer for loop for number of rows
for row in range(n):
# Inner for loop columns
for column in range(n - 2):
# prints first and last row
if (
((row == 0 or row == n-1) and (0 < column < n-3)) or
# prints first column
column == 0 or
# prints last column
column == n - 3 and (row != 0 and row != n - 1)
):
print("*", end=" ")
else:
print(" ", end="")
print()
# Size of the letter
num = int(input("Enter the size \t"))
if num < 8:
print("Enter a number atleast 8")
else:
print_pattern(num)