12409 - Python2020_MOOCS_Practice_Problem1   

Description

Write a program that prompts the user to input two strings and reports the two strings' lengths, by reporting the shorter string first. But if they are of the same length then keep them in the original order.  For example, (blue text = typed input, green highlight = program printout)
$ python3 compstr.py
Enter a string:
Great
Enter another string:
job
Shorter string: job (length 3)
Longer string: Great (length 5)

$ python3 compstr.py
Enter a string:
Mary
Enter another string:
lamb
First string: Mary (length 4)
Second string: lamb (length 4)

$ 

Note that in case the strings are of different lengths, the program says Shorter and Longer, but in case the strings are of equal length, the program says First and Second.  You don't actually print in color… the letters are colored for illustration purpose only.

[HINT] Your program should start with these two lines:

s1 = input('Enter a string:\n')
s2 = input('Enter another string:\n')

Input

typed input (blue text)

Output

program printout (green highlight)

Sample Input  Download

Sample Output  Download




Discuss