Dictionary Values in Python
Level 258 keystrokes
This gets all values from a dictionary. The values() method returns a view of all dictionary values.
Python code
# Create a dictionary with three key-value pairs1data = {"a": 1, "b": 2, "c": 3}# values() returns a view of the values, without the keys# list() turns the view into a regular list, so it prints [1, 2, 3]2print(list(data.values()))Output
[1, 2, 3]
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this Python code and how often they appear.
"× 6:× 3(× 3)× 3,× 2.× 1{× 1}× 1=× 1