Dictionary of lists to list of lists
Write a Python program to convert {key: [values]} into [[key, values…], …].
{"sqa": [1, 4, 6], "tools": [3, 6, 9]}[['sqa', 1, 4, 6], ['tools', 3, 6, 9]]
Approach
[k, *v]unpacks the list after the key.
Solution
d = {"sqa": [1, 4, 6], "tools": [3, 6, 9]}print([[k, *v] for k, v in d.items()])[['sqa', 1, 4, 6], ['tools', 3, 6, 9]]
Learn the concept
New to this topic? Read the lesson, then come back.