Member-only story

Python Programming Language: Dictionary Functions

Jesse L
1 min readSep 17, 2021

--

Hi everyone, welcome back. Dictionaries are a data structure in the Python language capable of storing several items in a singular dictionary variable. Dictionaries are a built in data type in Python and we will go over the functions regarding dictionaries. For a more in depth tutorial on Dictionaries in Python, click here.

Dictionary Functions

  • clear(): removes every item from the dictionary
  • copy(): retrieves a copy of the dictionary
  • fromkeys(): retrieves a new dictionary with the given keys and associated values
  • get(): retrieves the associated value of the given key
  • items(): retrieves a list with tuples for each of the key value pairs
  • keys(): retrieves a list with all the keys in the dictionary
  • pop(): removes an item with the given key
  • popitem(): removes the last key value pair that was added
  • setDefault(): retrieves a value of a given key. If the given key is nonexistent, then the key is added with a given value
  • update(): updates the dictionary with a key value pair
  • values(): retrieves a list with all the values in the dictionary

--

--

Jesse L
Jesse L

Written by Jesse L

Hi, I'm a passionate technology enthusiast and lifelong learner. Beyond my technical pursuits, I'm also passionate about sharing my enthusiasm with others.

No responses yet