Skip to content
Advertisement

Print dictionary with multiple values seperated

I have a dictioanry that has a key with more than one value:

JavaScript

I would like the dictionary on output to look like:

JavaScript

My biggest struggle is to get the sam key to print the values on their own line.

Advertisement

Answer

you can use 2 for loops to first iterate on keys and value (dictionary) and the 2nd one to iterate on the set (dictionary values).

JavaScript

Output:

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