How can you explain this? How do their orders differ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can you explain this? How do their orders differ?

>>>"Aa"<"aa" True >>>"A"<"a" True

8th Jul 2017, 8:04 PM
Navaneeth Ashok
Navaneeth Ashok - avatar
3 Answers
+ 13
This is because of their ASCII number, try to paste the following line in your console: print( ord('A'), ord('a') ) You will see that the ASCII number of 'A' is lower than the ASCII number of 'a'. This is why =====> 'A' < 'a' = true
8th Jul 2017, 8:10 PM
Maz
Maz - avatar
0
Thanks!
8th Jul 2017, 8:15 PM
Navaneeth Ashok
Navaneeth Ashok - avatar
- 1
I don't exactly understand that, I think that python only counts one character: >>>"Aa"<"aa" # One character. True >>>"A"<"a" # One character. True
8th Jul 2017, 8:07 PM
Gage Young
Gage Young - avatar