Ask Question
4 February, 23:31

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.

+1
Answers (1)
  1. 5 February, 01:58
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers