Program to calculate Kinetic Energy and Potential Energy | Function to calculate Kinetic Energy ; Stores the Kinetic Energy ; Function to calculate Potential Energy ; Stores the Potential Energy ; Driver Code
def kineticEnergy ( M , V ) : NEW_LINE INDENT KineticEnergy = 0.5 * M * V * V NEW_LINE return KineticEnergy NEW_LINE DEDENT def potentialEnergy ( M , H ) : NEW_LINE INDENT PotentialEnergy = M * 9.8 * H NEW_LINE return PotentialEnergy NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT M = 5.5 NEW_LINE H = 23.5 NEW_LINE V = 10.5 NEW_LINE print ( " Kinetic ▁ Energy ▁ = ▁ " , kineticEnergy ( M , V ) ) NEW_LINE print ( " Potential ▁ Energy ▁ = ▁ " , potentialEnergy ( M , H ) ) NEW_LINE DEDENT