24
How would you write mathematical term in Python as an expression?
a) (a+b)²
Answers
Answered by
1
Answer:
- The Python expression for (a+b)² is - (a + b)*(a + b) or, (a+b) * * (a+b)
Explanation:
- (a + b) calculates the sum of a and b. + operator is used for addition. Note: You must give the brackets here.
- Now (a + b) is multiplied with (a + b) to get the value of (a + b)².
- We can also write (a+b) * * 2. x * * y returns x raised to the power y. Similarly, (a+b) * * 2 returns (a + b) raised to the power 2.
Note:
- Avoid adding spaces between asterisks when performing exponentation.
Similar questions