This series of tutorials brings to the table a wide range of explanations and practical examples about dictionaries, sets, and tuples in Python.
- 1Python dictionary vs JavaScript object: What’s the difference?
- 24 ways to create a dictionary in Python
- 33 ways to iterate through a dictionary in Python
- 4Python: How to access and modify dictionary items
- 5How to clone a dictionary in Python – Shallow and Deep Copies
- 6Is key order preserved in a Python dictionary?
- 7How to add new key-value pairs to a dictionary in Python
- 8Removing items from a dictionary in Python (basic and advanced examples)
- 9Python: How to get a view of all keys, values, and items in a dictionary
- 10Python: How to get a reverse iterator over a dictionary’s keys
- 11Python: Checking if a key exists in a dictionary
- 12Python: Checking if a value exists in a dictionary
- 13Python: How to set a default value for a key in a dictionary
- 14Python: How to Create a JSON String from a Dictionary
- 15Python: Using variables as dictionary keys (basic and advanced examples)
- 16How to merge 2 dictionaries in Python (4 approaches)
- 17Python: How to compare 2 dictionaries (4 approaches)
- 183 ways to count items in a dictionary in Python
- 19How to update a nested dictionary in Python (basic and advanced)
- 20Python: Using type hints with dictionaries
- 21Python: How to get the length of a dictionary
- 22Python: Delete items from a dictionary using a list of keys (4 ways)
- 23Python: How to sort a dictionary by key or value (4 examples)
- 24Python: How to update a list value in a dictionary
- 25Python: How to convert a string to a dictionary
- 26Python: How to convert a dictionary to a string (basic and advanced examples)
- 27The maximum number of items a dictionary can hold in Python: Explained with Examples
- 28Python: How to rename a key in a dictionary (4 ways)
- 29Python: How to read a CSV file and convert it to a dictionary
- 30Python: 5 Ways to Check if a Dictionary is Empty
- 31Python: How to convert a dictionary to a class object (basic and advanced examples)
- 32Python: How to Get a Random Value from a Dictionary
- 33Python: Using dataclass to create dictionary-like object
- 34Python Error: ‘dictionary update sequence element #0 has length X; 2 is required’
- 35Python Error: ‘dict’ object has no attribute ‘append’
- 36Python Error: ‘dict’ object has no attribute ‘iteritems’
- 37Python: How to get a random item from a dictionary
- 38Python: How to Pretty Print a Deeply Nested Dictionary (Basic and Advanced Examples)
- 39Python RuntimeError: directory changed during iteration
- 40Python: How to get the first/last item from a dictionary
- 41Python: Passing a dictionary as a function argument
- 42Python: How to find the difference between 2 dictionaries
- 43Set and FrozenSet in Python: What’s the difference?
- 445 ways to create a set in Python
- 45Python: Checking if a dict is a subset of another dict
- 46Python: How to compare 2 sets
- 47Python – Set Union and Intersection (basic and advanced examples)
- 48Python Set – symmetric_difference_update() method
- 49Python Set – difference_update() method (examples)
- 50Python: How to convert a set to a list and vice-versa
- 515 tricks to maintain the order in a set in Python
- 52Python: How to add new elements to an existing set (4 ways)
- 53Python: How to get an element from a set
- 54Python: How to find the intersection of N sets
- 555 ways to create a tuple in Python
- 56Range Type in Python: The Ultimate Guide (with Examples)
- 57Python: Checking if 2 ranges overlap (4 examples)
- 58Working with named tuples in Python (basic and advanced examples)
- 59How to compare 2 tuples in Python (basic and advanced)
- 60How to sort a list of tuples in Python (basic and advanced examples)
- 61Python: How to convert a list to a tuple and vice-versa
- 62Python: Using type hints with tuples (basic and advanced examples)
- 63Python: How to create a new tuple from 2 existing tuples (basic and advanced examples)
- 64Python: Combine N lists to a single list of tuples
- 65Python: How to unzip a list of tuples to flat lists
- 66How to filter a list of tuples in Python (5 ways)
- 67Python: Counting the occurrences of elements in a tuple
- 68Python: How to convert a list of tuples to a dict
- 69Python: Typing a list of tuples for consistent data structure
- 70Python: How to convert a tuple to a string and vice versa
- 714 ways to loop through a tuple in Python
- 72Python: How to use aliases to access returned values from a function that returns a tuple
- 73Python – How to unpack a tuple Pythonically
- 742 Ways to Create an Empty Tuple in Python
- 75Python: How to Convert a Dictionary to a Query String
- 76Python: Define Generic Types for Lists of Nested Dictionaries
- 77Python: Using type hints with NamedTuple – Examples