3. Write the following expressions using operators used in Python:
i) x = a + b3 + c3 ii) A=rr(r+h)2
Answers
Answered by
6
x = a + b*b*b+ c*c*c
A = r*r*(r + h)*2
Answered by
5
Given:
(i)
(ii)
To Find:
Expressions of equations (i) and (ii) using operators in python.
Solution:
General arithmetic operators in Python are as follows:-
- Addition(+) = +
- Subtraction(₋) = ₋
- Multiplication() = *
- Division() = /
- 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:-
- 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