Please can someone explain to me why the following bool is True.
print( “3” > “13”)
True
Please can someone explain to me why the following bool is True.
print( “3” > “13”)
True
as they are string it is probably about the ASCII code of the first character in each
It has to do with the ASCII code of the character as @ilenia said , but also the fact that comparative operations on strings are done lexicographically. So:
"3" > "13"
Is taken as:
"3" > "1"
Which is converted to ASCII:
ord("3") > ord("1")
Hope that helps
Thank you very much guys