[Tutor] string rules for 'number'

boB Stepp robertvstepp at gmail.com
Sun Oct 7 19:59:21 CEST 2012


On Oct 7, 2012 12:47 PM, "Arnej Duranovic" <arnejd5 at gmail.com> wrote:
>
> When I type this in the python idle shell ( version 3...) :
>             '0' <= '10' <= '9'
> The interpreter evaluates this as true, WHY? 10 is greater than 0 but not
9

Since they are strings it looks at these character by character. Since '0'
< '1' < '9' , the 0 in '10' has no effect on the order.  Compare 'a' < 'ba'
< 'i' .

boB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20121007/fa868f12/attachment.html>


More information about the Tutor mailing list