Skip to content

Commit b2b59b1

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

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

physics/collisions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,4 @@ def type_collision(
139139
if __name__ == "__main__":
140140
import doctest
141141

142-
doctest.testmod()
142+
doctest.testmod()

physics/potential_energy.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ def gravitational_potential_energy(mass: float, height: float) -> float:
4040
4141
Returns:
4242
The value of energy in Joules
43-
43+
4444
Complexity:
4545
Time Complexity: O(1) - Constant execution time for evaluation logic.
46-
Space Complexity: O(1) - Constant memory allocation.
46+
Space Complexity: O(1) - Constant memory allocation.
4747
4848
Examples:
4949
>>> gravitational_potential_energy(10,10)
@@ -70,6 +70,7 @@ def gravitational_potential_energy(mass: float, height: float) -> float:
7070

7171
return mass * g * height
7272

73+
7374
def spring_potential_energy(spr_con: float, dspl: float) -> float:
7475
"""
7576
Function calculates the spring potential energy of an object.
@@ -80,10 +81,10 @@ def spring_potential_energy(spr_con: float, dspl: float) -> float:
8081
8182
Returns:
8283
The value of energy in Joules
83-
84+
8485
Complexity:
8586
Time Complexity: O(1) - Constant execution time for evaluation logic.
86-
Space Complexity: O(1) - Constant memory allocation.
87+
Space Complexity: O(1) - Constant memory allocation.
8788
8889
Examples:
8990
>>> spring_potential_energy(100,2)
@@ -97,14 +98,14 @@ def spring_potential_energy(spr_con: float, dspl: float) -> float:
9798
>>> spring_potential_energy(17,4.5)
9899
172.125
99100
"""
100-
if spr_con < 0 :
101+
if spr_con < 0:
101102
raise ValueError("The values for spring_constant cannot be negative")
102-
103-
return 0.5 * spr_con * (dspl ** 2)
104103

104+
return 0.5 * spr_con * (dspl**2)
105105

106106

107107
if __name__ == "__main__":
108108
from doctest import testmod
109-
print(spring_potential_energy(17,4.5))
109+
110+
print(spring_potential_energy(17, 4.5))
110111
testmod(name="gravitational_potential_energy")

0 commit comments

Comments
 (0)