In: Computer Science
please answer this in a simple python code
1. Write a Python program to construct the following pattern (with alphabets in the reverse order). It will print the following if input is 5 that is, print z one time, y two times … v five times. The maximum value of n is 26. z yy xxx wwww vvvvvv
Program:
num=int(input("\nPlease enter the input(1-26): "))
if(num>=1 and num<=26 ):
k=122
for r in range(1,num+1):
for c in range(1,r+1):
ch=chr(k)
print(ch,end="")
k=k-1
print("")
else:
print("Invaid number!!")
Program Screenshot:
Output: