Skip to content
Advertisement

How to assign multiple values to key in dictionary

I want to assign multiple values to Teams, lose and won in dictionary for every team entered by the user.

JavaScript

But when I run the code above I get output like:

JavaScript

I only get the result of the latest team. What should I do to assign multiple values to key?

if there are two teams the expected output should be:

JavaScript

Advertisement

Answer

Like this ,

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement