[Tutor] help with and
steve at pearwood.info
Wed Mar 1 06:07:34 EST 2017
On Wed, Mar 01, 2017 at 09:29:04AM +0000, Alan Gauld via Tutor wrote:
> You need to be explicit:
> if hours_worked > 40 and hours_worked < 60:
> You can also write what you intend in a slightly
> different form:
> if (40 < hours_worked < 60):
> The second form an unusual style that I've only
> ever seen in Python, most languages insist you
> use the first version.
That sort of chained comparison is standard mathematics notation which
is hopefully familiar to anyone who has done maths in secondary school.
I consider it a serious weakness of other languages that they don't
support chained comparisons.
Perl6, Coffeescript and Julia are three modern languages which support
More information about the Tutor