Skip to content
Dictionary Methods

values()

Return a dynamic view of all values in the dictionary.

dict.values()

dict.values() returns a dictionary view containing all the values present in the dictionary.

Values can be duplicates and follow the insertion order of their respective keys.

Returns

A dict_values view of all values.

Try it

Run it and change it
sales = {"Q1": 15000, "Q2": 22000, "Q3": 18500, "Q4": 24000}
total_sales = sum(sales.values())
print("Total Sales:", total_sales)

Worth knowing

  • Aggregation functions: You can pass dict.values() directly to built-in functions like sum(), min(), max(), or all().

Related entries