13. Write a python program to calculate the mathematics question of (a + b) * (a + b)
The output is:
a = 5
b = 8
Expected Answer:
(5 + 8) * (5 + 8) = 169
Answer 1:
a, b = 5, 8 result = a * a + 2 * a * b + b * b print("({} + {}) * ({} + {}) = {}".format(a, b, a, b, result))
Answer 2:
a, b = 5, 8 result = a ** 2 + 2 * a * b + b **2 print("({} + {}) * ({} + {}) = {}".format(a, b, a, b, result))
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)