I am trying to merge dictionaries returning from for loop. I have to then take maximum total from the dictionary. I am new to python. Please find below my code.
def winner(dictn):
for k,v in dictn.items():
total = 0
for k1,v1 in v.items():
total = total+v1
team = {k:total}
print(team)
winner(qualifier_2)
And my current output is:
{'KKR': 2236}
{'MI': 1759}
dictionary after update should look like: {'KKR': 2236, 'MI':1759}
Then it should return the team which scored maximum runs ie. winner Expected output: KKR