Question: Write a program with a function that takes a string as an argument from user which displays the string in descending lexicographical order (dictionary order).

Write a program with a function that takes a string as an argument from user which displays the string in descending lexicographical order (dictionary order). Suppose user enters ahmad then output should bemhdaa. The program should contain at least 5 characters. If there are less than 5 characters, then your program must throw an integer exception. If the user enters only numeric characters, then your program must also throw an integer exception. Write appropriate catch blocks for exceptions.

Step by Step Solution

3.31 Rating (145 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Python def descendingorderstr1 if lenstr1 5 raise ExceptionString length should be greater than or equal to 5 if not str1isalpha raise ExceptionString should contain only alphabets result sortedstr1 r... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Network Questions!