Skip to content

Commit d53a1d8

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

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

physics/first_law_of_thermodynamics.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ def categorize_system(argument_value: float, argument_name: str) -> None:
4343
print("The system is expanding.")
4444
elif argument_value < 0:
4545
print("The system is compressing.")
46-
46+
4747
elif argument_name == "heat":
4848
if argument_value == 0:
4949
print("The system is adiabatic (no heat exchange).")
5050
elif argument_value > 0:
5151
print("The system is endothermic (absorbing heat).")
5252
elif argument_value < 0:
5353
print("The system is exothermic (releasing heat).")
54-
54+
5555
elif argument_name == "internal_energy_variation":
5656
if argument_value == 0:
5757
print("The system is isothermic (constant internal energy)")
@@ -84,11 +84,12 @@ def work(heat: float, internal_energy_variation: float) -> float:
8484

8585
categorize_system(heat, "heat")
8686
categorize_system(internal_energy_variation, "internal_energy_variation")
87-
87+
8888
work = heat - internal_energy_variation
8989
categorize_system(work, "work")
9090
return round(work, 1)
9191

92+
9293
def heat(internal_energy_variation: float, work: float) -> float:
9394
"""
9495
>>> heat(-20.0, 30.0)
@@ -112,11 +113,12 @@ def heat(internal_energy_variation: float, work: float) -> float:
112113

113114
categorize_system(internal_energy_variation, "internal_energy_variation")
114115
categorize_system(work, "work")
115-
116+
116117
heat = round(internal_energy_variation + work, 1)
117118
categorize_system(heat, "heat")
118119
return heat
119120

121+
120122
def internal_energy_variation(heat: float, work: float) -> float:
121123
"""
122124
>>> internal_energy_variation(50.0, 30.0)
@@ -140,11 +142,12 @@ def internal_energy_variation(heat: float, work: float) -> float:
140142

141143
categorize_system(heat, "heat")
142144
categorize_system(work, "work")
143-
145+
144146
internal_energy_variation = round(heat - work, 1)
145147
categorize_system(internal_energy_variation, "internal_energy_variation")
146148
return internal_energy_variation
147149

150+
148151
if __name__ == "__main__":
149152
from doctest import testmod
150153

0 commit comments

Comments
 (0)