From Newsgroup: sci.lang
2 & 2 = 2
(Bitwise AND) interesting!
The bitwise OR operator in Python is represented by the vertical bar
symbol |
___________________
In Python, the expression (2 and 2) uses the logical and
operator, not a bitwise or arithmetic operation.
With and, Python evaluates the first operand (2), which is considered
True because it is a nonzero value.
It then evaluates the second operand (2) and returns it, since both
operands are "truthy."
Thus, (2 and 2) in Python evaluates to 2.
__________________________________
___________________ Huh! Python returns the last truthy value, just
like Lisp!
On Fri, 23 May 2025 12:38:03 +0000, Richard Heathfield wrote:
On 23/05/2025 12:51, Peter Moylan wrote:
On 23/05/25 20:46, Richard Heathfield wrote:
On 23/05/2025 11:32, RunningMuso wrote:
Huh? 2 + 2 + (2/2).
See Subject header: "Using only two 2s"
2 + 2 + (2/2) uses four twos.
Yes, but they taught me at school that two twos are four.
Not necessarily.
2 - 2 = 0
log 2 = 1 (or just 2/2 = 1)
2
2 & 2 = 2
___
2 + floor(\/2 ) = 3
___ ___
\/ 2 x \/ 2 = 2
2 + 2 (as you say) = 4
__________
\/(.2)^(-2) = 5
floor(pi * (2&2)) = 6
ceiling(pi * (2&2)) = 7
(2&2)^floor(pi) = 8
floor(pi*pi)/(2&2) = 9
2/.2 = 10
--- Synchronet 3.21a-Linux NewsLink 1.2