One string more than another (>)

Hello in the Complete Python Mastery Course, in Section 3 - Control Flow, Episode 7 - Quiz, there is a comparison between “bag” > “apple” and “bag” > “cat”. From a previous episode, I remembered that “bag” > “apple” is True. However, I do not know how to tell that “cat” comes after “bag”.
Additionally, since each character is tied to a number in python, how does it calculate the total? Is it a summation of all the numbers tied to the characters in the string that python then uses to calculate the expression?