Python program to solve the given math formula.

In this python basic program, we will solve the given math formula.
Formula : (a – b)2 = a^2 + b^2 – 2ab

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)2 = a^2 + b^2 – 2ab
  4. Print the output.
				
					a = 2
b = 3
result = a**2-2*a*b+b**2

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

Output :

				
					(a-b)^2:  1
				
			

solve the given math formula.
Formula : (a + b)2 = a^2 + b^2 + 2ab

solve the given math formula. Formula : a2 – b2 = (a-b)(a+b)

Leave a Comment