Repository navigation
Expand file tree
/
Copy pathmain.py
More file actions
46 lines (37 loc) · 1.36 KB
/
Copy pathmain.py
File metadata and controls
46 lines (37 loc) · 1.36 KB
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
43
44
45
46
"""
Program calculating energy consumption and cost
by using the module energy_calculation
"""
import energy_calculation
emil_time = 2.5 / 60
andreas_time = 3.5 / 60
mikael_time = 0.5 / 60
kenneth_time = 0.5 / 60
emil_energy = energy_calculation.calculate_energy(emil_time)
andreas_energy = energy_calculation.calculate_energy(andreas_time)
mikael_energy = energy_calculation.calculate_energy(mikael_time, 600)
kenneth_energy = energy_calculation.calculate_energy(kenneth_time, 600)
emil_cost = energy_calculation.calculate_cost(emil_energy)
andreas_cost = energy_calculation.calculate_cost(andreas_energy)
mikael_cost = energy_calculation.calculate_cost(mikael_energy)
kenneth_cost = energy_calculation.calculate_cost(kenneth_energy)
emil_string = "Emil använder {energy:.4f} kWh och detta kostar {cost:.4f} kr".format(
energy=emil_energy,
cost=emil_cost
)
andreas_string = "Andreas använder {energy:.4f} kWh och detta kostar {cost:.4f} kr".format(
energy=andreas_energy,
cost=andreas_cost
)
mikael_string = "Mikael använder {energy:.4f} kWh och detta kostar {cost:.4f} kr".format(
energy=mikael_energy,
cost=mikael_cost
)
kenneth_string = "Kenneth använder {energy:.4f} kWh och detta kostar {cost:.4f} kr".format(
energy=kenneth_energy,
cost=kenneth_cost
)
print(emil_string)
print(andreas_string)
print(mikael_string)
print(kenneth_string)