Can anybody please tell me why the string comparisons below deliver these results?
>>"1040"<="12000"
True
>> "1040"<="10000"
False
I’ve tried the string comparison in both C and Python, the result is obviously correct, I just can’t figure out how the result is calculated…
P.S.: I know that comparing strings of different length is something you shouldn’t do, but I’m still wondering about the logic behind the above lines 😉
“1” is equal to “1”.
“0” comes before “2” (so “1040” < “12000”).
“4” comes after “0” (so “1040” > “10000”).