On Sun, Oct 7, 2012 at 1:46 PM, Arnej Duranovic <arne...@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
> Notice I am not using the actual numbers, they are strings...I thought that
> numbers being string were ordered by their numerical value but obviously
> they are
> not? Can anyone explain this to me and explain how strings with numbers in
> them are ordered?
>
> Thx in advance.
>
because '0' is less than '1', and '1' is less than '9'

The comparison is done on a character by character basis


-- 
Joel Goldstick
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to