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