0
1+1*false=1~true
how is the solution to this question false? it should be true!
3 Respuestas
+ 2
First of all, this is not a working python code. There are at least 3 mistakes in it.
1. The most important. ~ is an unary operator not a binary one. You can use ~x, not a~b.
2. = is an assignment operator. Use == to check for equality.
3. False and True not false and true. Python is case sensitive.
Thus, formulate your question correctly to get the right answer.
+ 1
The operations aren't performed from left to right. Multiplication happens before addition, so it first figures out 1*false, then adds 1 to that. The result is 1 on the left, and 0 on the right, or 1 == 0, which is false.
0
thanks for the reply. :-)