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:
Instructions
Input
Two lines containing a string on each.
VeryLongText
ShortText
Output
A line containing a string.
First
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
Comments
Leave a comment