Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with dictionaries
#2
b = {"a":[0,5,3,-5], "b":[5,5,5,0], "c":[1,5,5,0]}
sums = {key: sum(value) for key, value in b.items()}
print(sums)
Reply


Messages In This Thread
Help with dictionaries - by bwdu - May-17-2020, 05:34 PM
RE: Help with dictionaries - by deanhystad - May-17-2020, 05:44 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020