Answer to Question #261579 in Python for Mikee

Question #261579

4. Length Comparison Redux

by CodeChum Admin

The first time around we did this was a bit simple. Let's kick it up a notch don't you think?


Instructions:

  1. Input two strings in different lines.
  2. If the 1st string is longer than the 2nd string, print "First". If the 2nd string is longer than the 1st string, print "Second". But if both strings have the same length, print "Equal".

Instructions

  1. Input two strings in different lines.
  2. If the 1st string is longer than the 2nd string, print "First". If the 2nd string is longer than the 1st string, print "Second". But if both strings have the same length, print "Equal".

Input

Two lines containing a string on each.


VeryLongText
ShortText

Output

A line containing a string.


First
1
Expert's answer
2021-11-08T17:37:29-0500


SOLUTION TO THE ABOVE QUESTION


SOLUTION CODE


#prompt the user to enter two strings
string_1 = input("Enter first string: ")
string_2 = input("Enter second string: ")
#Find the length of the two strings
string_1_length = len(string_1)
string_2_length = len(string_2)
if string_1_length > string_2_length:
    print("First")
elif string_2_length > string_1_length:
    print("Second")
else:
    print("Equal")


SAMPLE PROGRAM OUTPUT



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS