How does comparing strings of different lengths work?

Why does print("abcd" > "abc") return True?

23rd Mar 2016, 9:34 PM
Davide Amato
Davide Amato - avatar
3 Answers
+ 2
It's the alphabetical order. "abcd" contains the "abc" plus the "d" so it is bigger than the "abc" and thus it returns as true. hope it helped a bit.
3rd Apr 2016, 3:48 PM
George Tavanidis
George Tavanidis - avatar
so essentially abcd is equivalent to 1,2,3,4.which means "ab"==1+2 and " cd"==3+4 OK got it
2nd Jul 2016, 4:48 AM
Reuben Teitsu
Reuben Teitsu - avatar
ascii of abcd>ascii of abc
6th Jul 2016, 6:16 PM
naveen panjala
naveen panjala - avatar