Print the keys
Write a Python program to print the keys of a dictionary, capitalised.
{"pepsi": 50, "sprite": 60, "slice": 55}Pepsi Sprite Slice
Approach
- Loop over the dict.
Solution
drinks = {"pepsi": 50, "sprite": 60, "slice": 55}for name in drinks: print(name.title())Pepsi Sprite Slice
Learn the concept
New to this topic? Read the lesson, then come back.