Method Name:
values
Method Signature:
values()
Method Overview:
- Using a Python dictionary data can be organised using keys. The data stored against a key is called a value. The dict class of Python organises key-value pairs as a dictionary. The keys in a Python dictionary are unique. A dictionary can not have two keys with the same value.
- A dynamic view of the dictionary values can be obtained by calling the dict method values().
- The dict method values() returns the values of the dictionary as dict_values instance.
- Contents of the dict_values changes when the dictionary is changed of a value.
Parameters:
None
Return Value:
A dictionary view of type dict_values.
Example:
# Example Python program that obtains a view # Change the value of y # Witness the dictionary changes from the view |
Output:
Values present in the dictionary: |