Write a function longer_string() with two string input parameters that returns the string that has more characters in it. If the strings are the same size, return the string that occurs later according to the dictionary order. Use the function in a program that takes two string inputs, and outputs the string that is longer.

Respuesta :

TJC07

Answer:

Here you go :)

Explanation:

Change this to your liking:

def longer_string(s1, s2):

   if len(s1) > len(s2):

       return s1

   elif len(s1) < len(s2):

       return s2

   else:

       return s2

x = input("Enter string 1: ")

y = input("Enter string 2: ")

print(longer_string(x, y))