Skip to content

Commit 4d86697

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent facc61f commit 4d86697

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

physics/potential_energy.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ def gravitational_potential_energy(mass: float, height: float) -> float:
5454
if height < 0:
5555
# handling of negative values of height
5656
raise ValueError("The height above the ground cannot be negative")
57-
57+
5858
return mass * g * height
5959

60+
6061
def spring_potential_energy(spring_constant: float, displacement: float):
61-
#Function will except the spring constant and the displacemnt of the spring from equilibrium
62+
# Function will except the spring constant and the displacemnt of the spring from equilibrium
6263
"""
6364
>>> spring_potential_energy(100,2)
6465
200
@@ -67,11 +68,10 @@ def spring_potential_energy(spring_constant: float, displacement: float):
6768
>>> spring_potential_energy(8,0)
6869
0.0
6970
"""
70-
if spring_constant < 0 :
71+
if spring_constant < 0:
7172
raise ValueError("The values for spring_constant cannot be negative")
72-
73-
return 0.5 * spring_constant * (displacement ** 2)
7473

74+
return 0.5 * spring_constant * (displacement**2)
7575

7676

7777
if __name__ == "__main__":

0 commit comments

Comments
 (0)