forked from powerexploit/Awesome-Python-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchristmas_pattern.py
More file actions
57 lines (43 loc) · 1.14 KB
/
Copy pathchristmas_pattern.py
File metadata and controls
57 lines (43 loc) · 1.14 KB
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
44
45
46
47
48
49
50
51
52
53
54
#Python Program to print a simple christmas tree pattern using asterisk
def christmastree(level): #function definition
'''
Functions prints the pattern of christmas tree
params:
level: inputs the height of the tree
returns:
None
'''
a=level-1
b=1
for image in range(0,level):
for pixel in range(0,a):
print(' ',end='')
for image in range(0,b):
print('*',end='')
for pixel in range(0,a):
print(' ',end='')
b=b+2
a=a-1
print()
for l in range(3):
print(' '*(level-2),'*')
if __name__ == "__main__": #main function
level= int(input("Enter the height of christmas tree (Integer less than 30):")) #inputs the height of the tree
christmastree(level) #function calling
'''
Sample Output :
Enter the height of christmas tree (Integer less than 30):10
*
***
*****
*******
*********
***********
*************
***************
*****************
*******************
*
*
*
'''