Possible Duplicate:
How does Python compare string and int?
Can any one explain the below.how is the ‘a’ compared to 1
Internally is a and 1 ASCII val is compared or how is it
i.e, there is some conversion happening with ‘a’ and then compared or how is this.Please explain
>>> 'a' > 1
True
>>> 'a' > 'b'
False
Different types are compared lexigraphically, and “int” is < “string”.
In python 3.x, it changes this so different types aren’t comparible.
Bool < Int:
List > Int:
Tuple > List:
And for your example:
Str > Int:
And so on and so forth.