Practice question

Terry Reedy tjreedy at udel.edu
Mon Oct 6 01:47:40 CEST 2014


On 10/5/2014 7:02 PM, Seymore4Head wrote:
> For the record, I don't want a hint.  I want the answer.
> I see a practice question is similar to this.
> 15 <= x < 30  And it wants a similar expression that is equivalent.
> So the right answer is 15<= x or x <30
> but one of the other answers is
> not (15<= x and x <30)
>
> But it says.....remember you can try this out in the Python shell.
> How?

For instance,
for x in (10, 20, 30, 40):
     print((15 <= x < 30) == (15<= x and x <30))



-- 
Terry Jan Reedy




More information about the Python-list mailing list