how is the solution to this question false? it should be true!

11/28/2016 3:32:58 AM

G Girish

3 Answers

New Answer


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.


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.


thanks for the reply. :-)