-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDelta_S_surroundings.py
42 lines (35 loc) · 1.64 KB
/
Delta_S_surroundings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import Standard_entropy_calculator
import Standard_enthalpy_formation
import Temperature_calculator
def ssurroundings():
global surroundings
surroundings = -(Standard_enthalpy_formation.delta_h_final / Temperature_calculator.temp_value)
print(f'Your Delta S Surroundings is {surroundings:.7f} kJ/K')
def suniverse():
global surroundings
global universe
question = input(f'Do you want S Universe in J or kJ?\n ')
question = question.lower()
if question == "j":
universe = Standard_entropy_calculator.delta_s_final + (surroundings * 1000)
print(universe)
if universe > 0:
print(f'''Your Delta S Universe is {universe:.3f} J/K
The reaction is spontaneous''')
elif universe < 0:
print(f'''Your Delta S Universe is {universe:.3f} J/K
The reaction is not spontaneous''')
elif universe == 0:
print(f'''Your Delta S Universe is {universe:.3f} J/K
The reaction is at equilibrium''')
elif question == "kj":
universe = float(Standard_entropy_calculator.delta_s_final / 1000) + float(ssurroundings)
if universe > 0:
print(f'''Your Delta S Universe is {universe:.3f} kJ/K
The reaction is spontaneous since ΔSuni > 0''')
elif universe < 0:
print(f'''Your Delta S Universe is {universe:.3f} kJ/K
The reaction is not spontaneous since ΔSuni < 0 ''')
elif universe == 0:
print(f'''Your Delta S Universe is {universe:.2f} kJ/K
The reaction is at equilibrium since ΔSuni = 0''')