+ 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()

29th Aug 2020, 8:41 AM
‎Keshav
‎Keshav - avatar
1 Resposta
+ 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()
29th Aug 2020, 9:20 AM
Muskan Singh
Muskan Singh - avatar