Ask Question
Today, 07:28

3. Write a program that has the user enter two Strings. Display whether the first String is less than (comes first alphabetically), equal to, or greater than (comes after alphabetically) the first.

+5
Answers (1)
  1. Today, 08:28
    0
    The solution code is written in Python 3

    firstStr = input ("Enter first string: ") secondStr = input ("Enter second string: ") if (firstStr secondStr) : print ("The second string comes first alphabetically.") else: print ("The first and second string are same")

    Explanation:

    Firstly, prompt the user to input two strings (Line 1 - 2).

    Next create if else if statement to check if the firstStr is less than, greater than or equal to the secondStr and then print the appropriate message accordingly (Line 4 - 9). For example, the program display message "The first string comes first alphabetically." if it find the firstStr is less than secondStr.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “3. Write a program that has the user enter two Strings. Display whether the first String is less than (comes first alphabetically), equal ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers