[Tutor] string rules for 'number'
steve at pearwood.info
Mon Oct 8 00:40:52 CEST 2012
On 08/10/12 04:46, Arnej Duranovic 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?
Others have already explained that strings are ordered on a character-by-
character basis, not by numeric value. But I'm interested to ask how you
came to the conclusion that they were ordered by numeric value. Was there
something you read somewhere that gave you that (incorrect) impression,
perhaps something in the tutorial or the reference manual?
If so, please tell us, and we'll have it fixed.
More information about the Tutor