Skip to content

Instantly share code, notes, and snippets.

@pulkitpahwa
Created October 5, 2020 06:25
Show Gist options
  • Save pulkitpahwa/7d548e27247f4b554915b4d346847711 to your computer and use it in GitHub Desktop.
Save pulkitpahwa/7d548e27247f4b554915b4d346847711 to your computer and use it in GitHub Desktop.
Naive process of summing 2 dictionaries
# continued from https://gist.github.com/pulkitpahwa/a42aaafa4d6290a453299cec6bce64fc
sum_may_june_2020 = {}
for car, units_sold in may_2020.items():
sum_may_june_2020[car] = sum_may_june_2020.get(car, 0) + units_sold
for car, units_sold in june_2020.items():
sum_may_june_2020[car] = sum_may_june_2020.get(car, 0) + units_sold
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment