Energy Formula With Lambda In Python