Python program to solve the given math formula.

In this python basic program, we will solve the given math formula.
Formula : (a – b)3 = a3 – 3a2b + 3ab2 – b3

Steps to solve the program
  1. Take two variables as input and assign value to them.
  2. Using logic solve the given math formula.
  3. Formula : (a – b)3 = a3 – 3a2b + 3ab2 – b3
  4. Print the output.
				
					a = 3
b = 2
result = a**3-3*a**2*b+3*a*b**2+b**3

print("(a-b)^3: ",result)
				
			

Output :

				
					(a-b)^3:  17
				
			

solve the given math formula. Formula : (a + b)3 = a3 + 3ab(a+b) + b3 

calculate the area of the square.

Leave a Comment