- January 30, 2021 at 9:25 am #1608
- January 30, 2021 at 9:29 am #1631Erik van BaarenKeymaster
Python tells you:
‘<‘ not supported between instances of ‘int’ and ‘str’
This means you can’t compare two different types in Python. You can compare numbers with numbers, and you can also compare letters with letters.
I can see why you tried though since I gave an example where I did exactly that. I updated the tutorial page because I meant to give the example ‘1’ < 'a' instead of 1 < 'a'.
- February 2, 2021 at 3:29 pm #1663LuParticipant
If I follow this correctly then in the case ‘1’<‘a’ the 1 is not an integer type but the unicode character ‘1’
When looking at the character map, ‘!’ would be the smallest of all unicode characters and ‘ﻼ’ will be the largest. Python evaluated it to True
>>> '!'<'ﻼ' True
- You must be logged in to reply to this topic.