Learn practical skills, build real-world projects, and advance your career
Updated 2 years ago
kanto = [73, 67, 43]
johto = [91, 88, 64]
hoenn = [87, 134, 37]
#represents temp., rainfall, humidity data repectively
w1, w2, w3 = 0.3, 0.2, 0.5
weights = [0.3, 0.2, 0.5]
for item in zip(kanto, weights):
print (item)
(73, 0.3)
(67, 0.2)
(43, 0.5)
for x, w in zip(kanto, weights):
print(x)
print(w)
73
0.3
67
0.2
43
0.5
def crop_yield(region, weights):
result = 0
for x, w in zip(region, weights):
result += x * w
return result
crop_yield(kanto, weights)
56.8