 1+1*3==6. Is it yes or no. Someone help me | Sololearn: Learn to code for FREE!

+4

# 1+1*3==6. Is it yes or no. Someone help me

+24

+12

* has higher precedence, so the answer is 4.

+7

Explanation : The Answer is No. Just always remember the law of PEMDAS P = Parenthesis E = Exponent M = Multiply D = Divide A = Add S = Subtract the logic on the computer always do the PEMDAS,or it start from the Left to right, or PARENTHESIS to SUBTRACT,,,. so the question is "why 1+1*3 is not equal to 6" the answer is, 3*1 = 3, then 3 + 1 = 4. The multiply is always the first before the addition.

+4

now I got it 1+1*3==6 1+3==6 4==6 False

+3

+2

no it is prints False I have tried it on sololearn python. i don't understand why it is printing that because their is 1 also so it has to print "1 or true" atleast

+2

Helioform, what about == operator? I think it's priority is more than * operator.

+2

+1

I've written some code in code playground that helps explain answer to this and also covers how you can help figure out stuff like this, and how you can make the code do the addition first. I use comments (bits of text that are ignored by python, so that humans can put notes in the code for humans to read) in the code to explain everything, so read everything in there and then run it http://www.sololearn.com/app/python/playground/cpFOz8t1ZE2G/

+1

it will be "No" as == has higher producer value then * or + so if 1+1 * 3==6: ###(false) ###(it is false because, interpreter will first execute == , in case it is false, it neglect the + and * operator;) print("Yes") ###(the if statement will get terminated and execute else statement) else: print("No") ###(so, no will be shown on screen)

0

It is definitely "No" because at this point the lesson teaches that "==" has a higher precedence than "or". So if you do the math you'll see that the calculation is 1+1*3==6 --> 4==6 (which is False), this means that the "else" statement will be printed. You can try it in Code playground or in Python IDE if you're using a computer. Good luck!

0

It would be false because multiplication comes before adding. Try putting 1 + 1 in parenthesis and then run it. It should print True.

0

(1+1)*3=6 1+(1*3)=3 u should define brackets to get correct solution

-3

how.. 6==6.. its yes only know

-3

Yes its right according synergy