Combining lists with two lists of costs?

Question:

Hello I need help with combining lists where I am given two lists of costs from 2017 and 2018, to combine them into a single list called combined_costs and then calculate the sum of the costs from 2017-2018 called total_costs.

costs_2017 = [1300, 1500, 1360, 1789, 611]

costs_2018 = [1545, 789, 913, 8854, 462]

I figured out how to do the combined_costs:

combined_costs = cost_2017 + cost_2018

len(combined_costs)

But as for total_costs, I’m not sure if I am heading in the right direction but this is all I have for total_costs:

total_costs = combined_costs

Asked By: anj_M1

||

Answers:

If you are looking for a sum then:

total_costs = sum(combined_costs)

which is:

19123
Answered By: Allan Wind
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.