benzinrechner/minibenzinrechner.py

28 lines
534 B
Python
Executable file

#!/usr/bin/python3
cp, hp, cg, hg, og, m2, m3 = 8, 18, 12, 1, 16, 44, 1000
mw = cp * cg + hp * hg
dc = 0.7
lk = float(input("Liter/100km? ")) / 100
st = float(input("Strecke? "))
gv = st * lk
sw = gv * dc
gc2 = (cg + 2 * og) / cg
gh2 = (2 * hg + og) / 2 * hg
p_c = cp * cg / mw
p_h = hp * hg / mw
co2 = sw * p_c * gc2
h2o = sw * p_h * gh2
cvl = co2 / m2 * 22.4 * m3
print(
"",
gv,
"l",
sw,
"kg Sprit\n",
int(co2 * m3) / m3,
"kg",
int(cvl) / m3,
"m³ CO2\n",
int(h2o * m3) / m3,
"kg H2O",
)