Python Practice › Dictionary Programs › Program 86
List of all values
Write a Python program to get a list of all values.
Input
{"sqa": 1, "tools": 2, "is": 2, "best": 4}Output
[1, 2, 2, 4]
Approach
list(d.values()).
Solution
print(list({"sqa": 1, "tools": 2, "is": 2, "best": 4}.values()))Output
[1, 2, 2, 4]
Learn the concept
New to this topic? Read the lesson, then come back.