"or" is just the normal Python boolean operation.
When you evaluate y == 5 or y == 15, the Python interpreter first checks if the first statement is true:
sage: bool(y==5)
False
Since the first operand is false, the result of "or" is the second operand.
sage: y == 5 or 'second operand'
'second operand'
On Friday, December 7, 2012 1:45:37 PM UTC, charmi panchal wrote:
Hello !I would like understand how "or" works in sage.
I tried following .
var('y'); (y == 5 or y == 15)
and sage displays.
While I tried the same in mathematica and it just displays : (y == 5 or y == 15)
In sage "or" works perfect for boolean values, true and false.
But why sage chooses "y==15" instead of displaying "(y == 5 or y == 15)" like mathematica.
Best regards
Charmi