+ 5
I can make star pattern in ascending order but i don't know how to make it in descending order plz helpđ
a=int(input("How many rows do you want to? \n\n")) b=int(input("Press 1 for ascending order\nPress 2 for descending order\n\n")) if b==1: for i in range(0,a+1): for j in range(1,i+1): print("*",end=" ") print() if b==0: for i in range(a,0,-1): for j in range(i): print("*",end=" ") print()
1 Answer
+ 1
a=int(input("How many rows do you want to? \n\n"))
b=int(input("Press 1 for ascending order\nPress 2 for descending order\n\n"))
if b==1:
for i in range(0,a+1):
for j in range(1,i+1):
print("*",end=" ")
print()
elif b==2:
for i in range(a,0,-1):
for j in range(i):
print("*",end=" ")
print()