Skip to content

Commit 3588a53

Browse files
committed
Uploading the program
1 parent ed51fa3 commit 3588a53

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
def stepup_pattern(value):
2+
for i in range(value):# Loop use for creating number of rows
3+
for j in range(i): # Loop for printing pattern
4+
print(" * " , end =" ") # Printing the patttern
5+
print("\n")
6+
7+
def stepdown_pattern(value):
8+
i=value
9+
while(i>0):# Loop use for creating number of rows
10+
for j in range(i): # Loop for printing pattern
11+
print(" * " , end =" ") # Printing the patttern
12+
print("\n")
13+
i=i-1
14+
15+
16+
def pyramidal_pattern(value):
17+
space =value- 1 # defining variable for space
18+
for i in range(0,value): # Loop use for creating number of rows
19+
for j in range(0, space): # Loop for creating space
20+
print(end=" ") #Providing Space
21+
space = space - 1 # Decrement of space value
22+
for j in range(0, i + 1): # Loop for printing pattern
23+
print(" * ", end="") # Printing the patttern
24+
print("\r")
25+
26+
27+
def main():
28+
print(" Enter 1 for Stepup Pattern ")
29+
print(" Enter 2 for Stepdown Pattern ")
30+
print(" Enter 3 for Pyramidal Pattern ")
31+
choice=int(input (" ")) #input taking for performing the operation
32+
value=int(input(" Enter the number of steps "))
33+
34+
#Condition checking fordiffernent operation.
35+
if choice == 1:
36+
stepup_pattern(value)
37+
elif choice == 2:
38+
stepdown_pattern(value)
39+
elif choice == 3:
40+
pyramidal_pattern(value)
41+
42+
condition=int(input(" Enter 1 to continue or else to exit "))
43+
if condition == 1: #condition checking for re-executing the program.
44+
main() # Recalling main function
45+
else:
46+
exit() #exiting the program
47+
48+
49+
main() # Calling the main function

0 commit comments

Comments
 (0)