+ 1
If a word is much longer than the other, does it matter?
e.g print("autos" > "automovilismo") True or False?
3 Respostas
+ 7
Strings are compared lexically, like you'd find them in a dictionary.
Letter by letter will be compared, until a 'greater' one is found. (Something is greater than nothing.)
Otherwise equal.
So...
ab > aaa: True, because b>a.
What happens after second letter doesn't matter anymore.
So in your example, after 5th letter, the test is already over, because s>m.
+ 2
If you want the length to matter prefer the len function:
len("autos") > len("automovilismo")
+ 1
Thank you both so much