+ 3
How does >>> print( 'True' < "true") evaluate to result as True in Python? does Python consider the ASCII value for comparison?
2 Respuestas
+ 5
in ASCII 'T' = 84 and 't' = 116
so summary 'True' < 'true' then result is true
+ 3
The ASCII value for 'T' is less than the value for 't'. Python does lexicographical comparisons on strings therefore since T comes before t in ASCII, True is less than true.