Python Tutoring Online
 Home

Iterate Dictionary Values in Python

Iterating through dictionary values means accessing each value stored in a dictionary one by one.

While dictionaries store data in key-value pairs, sometimes we only need to work with the values. For example, calculating totals, displaying results, or analyzing stored data.

Python provides several simple ways to loop through dictionary values using loops and the values() method.

Need Help Learning Python?

Understanding how to loop through dictionary values is an important skill when working with data structures in Python.

A Python tutor can help you practice dictionary operations, loops, and real programming examples step-by-step.

Get Python Tutoring Help

Method 1: Using the values() Method

The most common way to iterate through dictionary values is by using the values() method.

This method returns all the values stored inside the dictionary. These values can then be accessed one by one using a loop.

Syntax

Python
for value in dictionary.values():
    print(value)

The loop runs once for each value in the dictionary.

Example

Python
student = {
"name":"Alice",
"age":21,
"course":"Python"
}

for value in student.values():
    print(value)

Output


Alice
21
Python

The values() method returns all dictionary values. The loop prints each value one at a time.

Notice that the keys are not printed, only the values.

Example 2: Using Values for Calculations

Dictionary values are often used in calculations. For example, a dictionary might store marks, prices, or scores.

Python
scores = {
"Math":85,
"Science":90,
"English":78
}

for value in scores.values():
    print(value)

Output


85
90
78

Each iteration prints the numeric values stored in the dictionary.

These values can later be used for calculations such as averages, totals, or comparisons.

Example 3: Calculating the Sum of Values

We can also use dictionary values to perform mathematical operations.

Python
scores = {
"Math":85,
"Science":90,
"English":78
}

total = 0

for value in scores.values():
    total = total + value

print(total)

Output


253

The program loops through each dictionary value and adds it to the variable total.

The final result represents the sum of all values in the dictionary.

Example 4: Converting Dictionary Values to a List

Sometimes we need dictionary values stored in a list for further processing.

Python
student = {
"name":"Alice",
"age":21,
"course":"Python"
}

values_list = list(student.values())

print(values_list)

Output


['Alice', 21, 'Python']

The list() function converts the dictionary values into a Python list.

This allows us to apply list operations such as sorting or indexing.

Why Iterating Values Is Useful

Common Beginner Mistakes

Related Python Dictionary Tutorials




Stuck Learning Python?

Struggling with Python syntax, assignments or debugging errors? Learning alone can be frustrating.

Get 1-on-1 Python tutoring and learn faster with clear explanations, real examples and live help.

    Get Python Tutoring

PythonTutor.net

Home    Tutorial     Online Live Trainings    Contact Us           © 2026 All rights reserved by www.PythonTutor.net