Computer Science, asked by SinMo7, 7 months ago

3. Write the following expressions using operators used in Python:
i) x = a + b3 + c3 ii) A=rr(r+h)2​

Answers

Answered by pratikchoudhari
6

x = a + b*b*b+ c*c*c

A = r*r*(r + h)*2

Answered by mad210203
5

Given:

(i) x=a+b^{3} +c^{3}

(ii) A=rr(r+h)^{2}

To Find:

Expressions of equations (i) and (ii) using operators in python.

Solution:

General arithmetic operators in Python are as follows:-

  • Addition(+) = +
  • Subtraction(₋) = ₋
  • Multiplication(\times) = *
  • Division(\div) = /
  • Power(^) = **
  • Prenthesis/ bracket = ( )

If multiple operators are used in an equation, they operate as per their precedence i.e. the operator higher in the precedence list will operate first.

The Precedence list for the above-mentioned operators is as follows:-

( )> /> **and*>+>-

  • To express the equations, we would also need an assignment operator i.e " = ". It assigns the right-hand side value to the left-hand side variable.

With the above knowledge of operators, we can now right the Python expressions as follows:-

(i) x = a + b**3 + c**3

(ii) A = r*r*((r+h)**2)

Similar questions