Skip to content

Commit 8fee167

Browse files
committed
ruff changes
1 parent 83f1c46 commit 8fee167

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

physics/collisions.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
"""
2-
Finding collision types and final velocities is key in physics.
2+
Collision types and final velocities are central to physics.
33
This module computes final velocities for inelastic and elastic collisions.
4-
It also identifies the collision type from initial and final velocities.
4+
It also classifies the collision type from initial and final velocities.
55
66
Description: Collisions happen when two masses interact head-on.
77
There are two types: inelastic and elastic. In inelastic collisions, the
88
masses stick together and share one final velocity. In elastic collisions,
9-
momentum and kinetic energy stay conserved, and the masses rebound.
10-
Momentum is mass times velocity, and kinetic energy is 1/2 mv^2.
11-
The type of collision can be found by comparing the system's initial and
12-
final momentum and kinetic energy.
9+
momentum and kinetic energy are conserved, and masses rebound.
10+
Momentum is mass times velocity; kinetic energy is 1/2 mv^2.
11+
The collision type comes from comparing initial and final momentum and
12+
kinetic energy of the system.
1313
1414
Reference: https://en.wikipedia.org/wiki/Collision
1515
"""
@@ -118,7 +118,7 @@ def type_collision(
118118

119119
if kinetic_final == kinetic_initial and momentum_initial == momentum_final:
120120
return 'Perfectly Elastic Collision'
121-
elif not(kinetic_final == kinetic_initial) and momentum_initial == momentum_final:
121+
elif kinetic_final != kinetic_initial and momentum_initial == momentum_final:
122122
return 'Perfectly Inelastic Collision'
123123
else:
124124
return "Inelastic Collision"

0 commit comments

Comments
 (0)