score = (x) -> if x == "Yes" 10 else 0 weights = [0.25, 0.25, 0.25, 0.25] responsible_lobbying = [policy, political_contributions_policy, lobbying_expenditures, third_party_political_lobbying] weights.reduce((weighted_sum, weight, index) -> weighted_sum + weight*score(responsible_lobbying[index]) , 0)