Chained Comparisons

Peter Otten __peter__ at web.de
Mon Mar 20 12:21:55 CET 2006


Sathyaish wrote:

> I) What does the following expression evaluate to?
> 
> a < b == c
> 
> 1) (a < b) and (b == c)
> 2) (a < b) or (b == c)

then later

> 1) It is easier to learn through an interactive medium like a forum;

There is a convenient alternative to asking basic questions on c.l.py or
ploughing through formal docs. When you have a clear conception of the
possible outcomes it is also reliable.

>>> 1 < 2 == 3
False

It can't be 'or' then. 
In short, the interactive prompt is *the* tool to learn about language
features and libraries.

Peter



More information about the Python-list mailing list