Determine whether one string is longer than another. To test if one string is longer than another, we use the len () function to get the length of each string and then use the > (greater than) comparison statement to compare the results.