Question: Question 2 Using a single one-way decision structure (i.e., an if structure with no else part), some relational operators and some logical operators (i.e., and,

 Question 2 Using a single one-way decision structure (i.e., an if

Question 2 Using a single one-way decision structure (i.e., an if structure with no else part), some relational operators and some logical operators (i.e., and, or, not), write a program that reads three characters and prints Characters are in strict order if the characters are sorted in either strictly ascending or strictly descending order, or prints Characters are not in strict order if the characters are not in sorted order or there are repeated characters which violate the "strictly" ascending or descending requirement. Here are some examples of input characters and the expected output: - if the characters entered are A,D and C, then the program should print Characters are not in strict order - if the characters entered are p,r and t, then the program should print Characters are in strict order - if the characters entered are P,e and g, then the program should print Characters are in strict order - if the characters entered are P,P and P, then the program should print Characters are not in strict order Note that when we say "in order" we are referring to the ordering based on the ASCII/Unicode character ordinal value which means simple relational operators can be used to compare the values. For example, "P" and "e" and "g" will be considered "in order" since "P" comes before "e" which comes before "g" in the ASCII/Unicode encoding table. Call the file containing your program, single_if_char py

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!