Compare strings based on alphabetical ordering

python

Solution

this should work:

if len(x)==len(y):
   return min(x,y)

Problem

Write a function that takes two strings as arguments and returns the one which is longer. If the strings have equal length, return the one that comes first alphabetically. This is what i have so far: ``` def strings(x,y): if len(x) > len(y): return x if len(x)==len(y): return else: return y ``` I am wondering how i would write the code so it would choose the string that comes first alphabetically for the second if statement.

Original source

Related problems