Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java An Introduction To Problem Solving And Programming

Authors: Walter Savitch

8th Edition

0134462033, 978-0134462035

More Books

Students also viewed these Computer Network questions