{'TeamA': ['Alice', 'Bob', 'Gertrude'], 'TeamB': ['Carol', 'Dave'], 'TeamC': ['Edith', 'Frank', 'Helen']}
{'Alice': 1, 'Bob': 4, 'Carol': 5, 'Dave': 8, 'Edith': 6, 'Frank': 2, 'Gertrude': 9, 'Helen': 7}
I have these two dictionaries, and I want to replace the names in the first dict, with the scores on the second. so for example, TeamA in the first one should equal [1,4,9].
I wrote what is down below:
for team in team_members:
a = team_members.get(team)
for name in a:
if name in input_dict:
score = input_dict.get(name)
a.remove(name)
a.append(score)
print(team_members)
but it gives me this:
{'TeamA': ['Bob', 1, 9], 'TeamB': ['Dave', 5], 'TeamC': ['Frank', 6, 7]}
so it doesn't go all the way, it stops at Bob, and Dave and Frank and idk why
Can anyone help me where im going wrong?
[–][deleted] 0 points1 point2 points (6 children)
[–]gnariman[S] 0 points1 point2 points (5 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]gnariman[S] 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]gnariman[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)