Computer Science, asked by garvit8927, 1 year ago

Why does the expression 2 + 3*4 result in the value 14 and not the value 24?

Answers

Answered by ROHITRAJCOC11
2

nNOW THIS IS GOOD QUESTION AND EASSY ALSO 2+3*4 IS YOU QUESTION * THIS SYMBOL REPRESENT YOU THAT PRODUCT OF TWO NUMBER MEANS

2+3×4

2+12

14

Answered by VIKRAMKUMAR99521
10

Explanation:

The reason is so simple.

First the python interpreter checks the OPERATOR PRECEDENCE which you can google it to see the order . In simple words we can say that the operator precedence is as such as BODMAS which we use in general mathematics calculation.

Likewise PYTHON has its own BODMAS known as  OPERATOR PRECEDENCE.

According to it first it will multiply 3 and 4 and then add 4.

Hence the result is 14.

This is how it happens:

* THIS SYMBOL REPRESENT YOU THAT PRODUCT OF TWO NUMBER THAT MEANS

⇒2+3×4

⇒2+12

⇒14

HOPE U FIND THE ANSWER HELPFUL. THANK YOU.

Similar questions