"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.
> y
> y == 15
>
> 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
>
>
>
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/sage-support?hl=en.