>
> In your code, you are comparing a string (an element of your CSV row)
> with a number.


Whoops, forgot to include recommendations. You probably do not want to
have comparisons of mixed type.  As we have found, the result we get
back is arbitrary and capricous.  Rather, we probably want to compare
two numbers.

To interpret a string as a number, use the int() or float() functions.

############################
>>> '10' > 10
True
>>> int('10') > 10
False
############################

References:

    https://docs.python.org/2/library/functions.html#int
    https://docs.python.org/2/library/functions.html#float
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to