From 09aa755e05bb5b3a0bdd1d469f16258aa99e6178 Mon Sep 17 00:00:00 2001 From: Vivek Soundrapandi Date: Tue, 16 Oct 2018 09:50:48 +0530 Subject: [PATCH] Mentioned about values inbuilt method in dictionary (#19257) The document has mentioned about keys method in dictionary . An equivalent & frequently used method is values. Added description and example for the same --- .../english/python/data-structures/dictionaries/index.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/src/pages/guide/english/python/data-structures/dictionaries/index.md b/client/src/pages/guide/english/python/data-structures/dictionaries/index.md index 26378f1a9c..2d80e31328 100644 --- a/client/src/pages/guide/english/python/data-structures/dictionaries/index.md +++ b/client/src/pages/guide/english/python/data-structures/dictionaries/index.md @@ -59,6 +59,12 @@ It's easy to add key-value pairs to an existing dictionary: >>> club_names ['chelsea', 'barcelona'] ``` +**`values`** is a built-in *method* that can be used to get the values of a given dictionary. To extract the values present in a dict as lists: +```python + >>> club_names = list(teams.values()) + >>> club_names + [1910, 1875] +``` Yet another way of creating dictionary is using the **`dict()`** method: ```python >>> players = dict( [('messi','argentina'), ('ronaldo','portugal'), ('kaka','brazil')] ) # sequence of key-value pair is passed