gk2410 commited on
Commit
0768102
·
verified ·
1 Parent(s): 4a86377

Create tools.py

Browse files
Files changed (1) hide show
  1. tools.py +42 -0
tools.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def estimate_footprint(transport, diet, electricity, shopping_freq):
2
+ score = 0
3
+
4
+ # Transport score
5
+ if transport == "Car":
6
+ score += 30
7
+ elif transport == "Public Transport":
8
+ score += 15
9
+ elif transport == "Cycle/Walk":
10
+ score += 5
11
+ elif transport == "Electric Vehicle":
12
+ score += 10
13
+
14
+ # Diet score
15
+ if diet == "Meat-heavy":
16
+ score += 30
17
+ elif diet == "Mixed":
18
+ score += 20
19
+ elif diet == "Vegetarian":
20
+ score += 10
21
+ elif diet == "Vegan":
22
+ score += 5
23
+
24
+ # Electricity score
25
+ if electricity > 600:
26
+ score += 20
27
+ elif electricity > 300:
28
+ score += 10
29
+ else:
30
+ score += 5
31
+
32
+ # Shopping score
33
+ if shopping_freq == "Every week":
34
+ score += 15
35
+ elif shopping_freq == "Monthly":
36
+ score += 10
37
+ elif shopping_freq == "Rarely":
38
+ score += 5
39
+ else:
40
+ score += 2
41
+
42
+ return score