22 Answers
New AnswerIm getting invalid output
4/16/2018 4:53:05 PM
Elisha Miracle22 Answers
New AnswerNormally, the operator precedence is this: parenthesis, multiplication, division, modulus, addition and subtraction 1 + 1 * 3 = 4 1 + ( 1 * 3 ) = 4 ( 1 + 1 ) * 3 = 6
Just check the precedent at first. Parantheses >exponentiation > multiplication/division > addition/ subtraction. It's shown the value is not true, so extract to No
As Dev said, you're missing a colon, it should be like this: if ( 1 + 1 ) * 3 == 6: // do stuff
multiplication is executed first .... in order to add 1 to 1 first , and then multiple the result by 3 u must put the addition in ()
Expanding on what noname said. Here's an article on Operator Precedence: https://en.wikipedia.org/wiki/Order_of_operations
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message