 if 1 + 1 * 3 == 6 print ("Yes") else : print ("No") | Sololearn: Learn to code for FREE!

-1

# if 1 + 1 * 3 == 6 print ("Yes") else : print ("No")

Im getting invalid output

+5

Normally, the operator precedence is this: parenthesis, multiplication, division, modulus, addition and subtraction 1 + 1 * 3 = 4 1 + ( 1 * 3 ) = 4 ( 1 + 1 ) * 3 = 6

+4

That's an invalid syntax. You're missing a colon (:) after 6.

+1

Just check the precedent at first. Parantheses >exponentiation > multiplication/division > addition/ subtraction. It's shown the value is not true, so extract to No

0

0

if (1+1*3==6) { print ("yes") ; } else : { print ("no") ; }

0

As Dev said, you're missing a colon, it should be like this: if ( 1 + 1 ) * 3 == 6: // do stuff

0

0

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 ()

0

if( (1+1) * 3 ==6) { bla bla bla }

0

Expanding on what noname said. Here's an article on Operator Precedence: https://en.wikipedia.org/wiki/Order_of_operations

0

0

Because the first it is multipluing

0

Elisha Miracle if 1 + 1 * 3 == 6 : print ("Yes") else : print ("No")

-1

it should like like this: if (1+1*3 == 6) { print ("Yes"); } else { print ("No"); }

-1

if(1 + 1 * 3 ==6): { print("yes"); } else: { print("no"); }