Can someone explain why print("abe" > "Abe") is true? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can someone explain why print("abe" > "Abe") is true?

16th Nov 2020, 9:10 AM
Abraham Kabui
Abraham Kabui - avatar
4 Answers
+ 4
When comparing string, it compares every char's ASCII value. In general, lower case is always have a greater ASCII value than upper case.
16th Nov 2020, 9:14 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 2
ascii of "a" = 97 ascii of "A" = 65 97 > 65 = True
18th Nov 2020, 6:57 AM
Shen Bapiro
Shen Bapiro - avatar
0
Very helpful, thanks
16th Nov 2020, 10:12 AM
Abraham Kabui
Abraham Kabui - avatar