s1 = 'longlongstring' s2 = 'shortstring' longestString = max(s1, s2, key=len) # returns 'longlongstring'