Question

# For the below Python expression: Evaluate the expression Show the PROCESS for how Python evaluates the...

For the below Python expression:

• Evaluate the expression
• Show the PROCESS for how Python evaluates the expression (order of operations and showing the steps Python takes to evaluate the problem).

3 % 3 * 14 == 18.2 / 8.1 and 3.1 + 15.7 * 19.1 >= 6.6 // 18 // 15.0

Solution:-

Precedence order of operators: * / % // , + - , >= , ==

Expression 1: 3 % 3 * 14 == 18.2 / 8.1

Firstly evaluating Left hand side 3 % 3 * 14 as % , * have same precedence so you evaluation will be done in Left to Right associativity order 3 % 3 * 14 = 0 * 14 = 0

Evaluating Right hand side 18.2 / 8.1 = 2.246

Clearly, LHS is not equal to RHS so it will return FALSE.

Expression 2:  3.1 + 15.7 * 19.1 >= 6.6 // 18 // 15.0

LHS: 3.1 + 15.7 * 19.1 = 3.1 + 299.87 = 302.97 (Because * has higher precedence than +)

RHS: 6.6 // 18 // 15.0 = 0.0 // 15.0 = 0.0

Clearly LHS >= RHS so it will return TRUE.

#### Earn Coins

Coins can be redeemed for fabulous gifts.