Python Reference
dict.values()
Return a view of all values in a dictionary. Iterable and dynamic.
Last updated: October 2026
Definition: dict.values() returns a view object containing all the values in the dictionary. The view is dynamic — it reflects changes made to the dict. It is iterable but not indexable.
🎬 Live Example
Five common values patterns. Click any button to see the output.
💡 values() returns a view, not a list. It reflects live changes to the dict.
Basic Syntax
dict.values()
# No arguments
# Returns: dict_values view object
# Dynamic — reflects dict changes
# Iterable but NOT indexable
🎯 Parameters
| Parameter | Type | Description |
|---|---|---|
| — | — | Takes no arguments. |
Basic Usage
d = {"name": "Alice", "age": 30}
d.values()
# dict_values(['Alice', 30])
for value in d.values():
print(value)
# Alice
# 30
Aggregate Values
scores = {"Alice": 85, "Bob": 92, "Cara": 78}
sum(scores.values()) # 255
max(scores.values()) # 92
min(scores.values()) # 78
len(scores.values()) # 3
Pro tip: values() is the go-to for numeric aggregations on dicts.
Convert to List
d = {"a": 1, "b": 2}
list(d.values())
# [1, 2]
# Now you can index
list(d.values())[0]
# 1
Note: Values views don't support indexing. Convert to a list first if you need v[0].
Dynamic View
d = {"a": 1}
values = d.values()
d["b"] = 2
list(values)
# [1, 2] ← reflects new value
del d["a"]
list(values)
# [2]
Real-World: Grade Report
grades = {
"Alice": 85,
"Bob": 92,
"Cara": 78
}
average = sum(grades.values()) / len(grades)
# 85.0
highest = max(grades.values())
# 92
print(f"Class average: {average:.1f}")
print(f"Highest score: {highest}")
🎯 values vs keys vs items
| Method | Returns | Use when |
|---|---|---|
values | Values only | You need only values |
keys | Keys only | You need only keys |
items | (key, value) pairs | You need both together |
⚠️ Common Mistakes
- Indexing values() directly. Values views don't support indexing. Use
list(d.values())[0]. - Treating values() as a list. It's a view — wrap in list() if needed.
- Modifying dict while iterating. Convert to list first.
- Using values() when you need keys too. Use items().
- Assuming values() returns a copy. It's dynamic — reflects live changes.
❓ Frequently Asked Questions
What does dict.values() do in Python?
dict.values() returns a view object containing all the values in a dictionary. The view is dynamic — it reflects changes made to the dict.
Is dict.values() a list?
No. In Python 3, it returns a view object. Wrap it in list() to get an actual list: list(d.values()).
Can I iterate over dict.values()?
Yes. The values view is iterable. Loop directly: for value in d.values().
Can I access values by index?
No. Values views don't support indexing. Convert to a list first: list(d.values())[0].
Does values() reflect changes to the dict?
Yes. The view is dynamic. Adding or removing keys updates the values view automatically.