Find Harmonic mean using Arithmetic mean and Geometric mean | Python 3 implementation of compution of arithmetic mean , geometric mean and harmonic mean ; Function to calculate arithmetic mean , geometric mean and harmonic mean ; Driver function
import math NEW_LINE def compute ( a , b ) : NEW_LINE INDENT AM = ( a + b ) / 2 NEW_LINE GM = math . sqrt ( a * b ) NEW_LINE HM = ( GM * GM ) / AM NEW_LINE return HM NEW_LINE DEDENT a = 5 NEW_LINE b = 15 NEW_LINE HM = compute ( a , b ) NEW_LINE print ( " Harmonic ▁ Mean ▁ between ▁ " , a , " ▁ and ▁ " , b , " ▁ is ▁ " , HM ) NEW_LINE