-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpattern.py
More file actions
39 lines (36 loc) · 903 Bytes
/
Copy pathpattern.py
File metadata and controls
39 lines (36 loc) · 903 Bytes
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
n = int(input("Enter number of lines in which we need to print first pattern : "))
# flag = n-1;
for i in range(0, n):
t=n-i;
while(t>0):
print(" ", end="")
t-=1
u=2*(i+1)-1;
while(u>0):
print("*", end="")
u-=1
print()
print()
n = int(input("Enter number of lines in which we need to print second pattern : "))
for i in range(1,n+1):
t=1
while(t<=i):
print("*", end="")
t+=1
print()
n = int(input("Enter number of lines in which we need to print third pattern, the number should be odd : "))
for i in range(1,n+1):
t=1
if(i==(n+1)/2):
# print("L", end="")
while(t<=n):
if(t==(n+1)/2):
print(" ", end="")
else:
print("*", end="")
t+=1
else:
while(t<=n):
print("*", end="")
t+=1
print()