0% found this document useful (0 votes)
15 views2 pages

Python Dictionaries: Functions & Usage

This document provides an overview of common Python dictionary functions and operations. It lists functions like len(), dict.keys(), dict.values(), and dict.items() for working with dictionary keys and values. It also describes operators like in and not in for checking dictionary membership and methods like dict.clear() and dict.pop() for modifying dictionaries. The document includes examples and provides a link for more information on Python dictionaries.

Uploaded by

Michael Leone
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

Python Dictionaries: Functions & Usage

This document provides an overview of common Python dictionary functions and operations. It lists functions like len(), dict.keys(), dict.values(), and dict.items() for working with dictionary keys and values. It also describes operators like in and not in for checking dictionary membership and methods like dict.clear() and dict.pop() for modifying dictionaries. The document includes examples and provides a link for more information on Python dictionaries.

Uploaded by

Michael Leone
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python Dictionaries

Function Description

len (object) -> int Determines how many items a dictionary has.

[Link]() -> object Returns a list of all the values in the dictionary.

[Link]() -> object Returns a list containing the dictionary's keys.

[Link]() -> object Returns a list containing a tuple for each key

value pair.

[Link](key, default = None) Returns the value of the specified key.

[Link]() Removes all the elements from the dictionary.

[Link](key) -> value Removes specified key and returns the

corresponding value.

Kuala Lumpur, Malaysia, phone: +601160906599, e-mail:academysamer@[Link]


Keyword Description

del keyword removes the item with the specified key name

Assume: dict_1 = {"course": "Python", "level": "beginner"}

Dictionaries Operators Description Example Result

in "level" in dict_1 True

not in Membership "course" not in dict_1 False

For more info about python dictionaries visit:

[Link]

To find out more about Python, web development, and data science visit us on:

Kuala Lumpur, Malaysia, phone: +601160906599, e-mail:academysamer@[Link]

You might also like