Working with Dict, Set, and Tuple in Python

This series of tutorials brings to the table a wide range of explanations and practical examples about dictionaries, sets, and tuples in Python.

1 Python dictionary vs JavaScript object: What's the difference?

2 4 ways to create a dictionary in Python

3 3 ways to iterate through a dictionary in Python

4 Python: How to access and modify dictionary items

5 How to clone a dictionary in Python - Shallow and Deep Copies

6 Is key order preserved in a Python dictionary?

7 How to add new key-value pairs to a dictionary in Python

8 Removing items from a dictionary in Python (basic and advanced examples)

9 Python: How to get a view of all keys, values, and items in a dictionary

10 Python: How to get a reverse iterator over a dictionary's keys

11 Python: Checking if a key exists in a dictionary

12 Python: Checking if a value exists in a dictionary

13 Python: How to Create a JSON String from a Dictionary

14 Python: How to set a default value for a key in a dictionary

15 Python: Using variables as dictionary keys (basic and advanced examples)

16 How to merge 2 dictionaries in Python (4 approaches)

17 Python: How to compare 2 dictionaries (4 approaches)

18 3 ways to count items in a dictionary in Python

19 How to update a nested dictionary in Python (basic and advanced)

20 Python: Using type hints with dictionaries

21 Python: How to get the length of a dictionary

22 Python: Delete items from a dictionary using a list of keys (4 ways)

23 Python: How to sort a dictionary by key or value (4 examples)

24 Python: How to update a list value in a dictionary

25 Python: How to convert a string to a dictionary

26 Python: How to convert a dictionary to a string (basic and advanced examples)

27 The maximum number of items a dictionary can hold in Python: Explained with Examples

28 Python: How to rename a key in a dictionary (4 ways)

29 Python: How to read a CSV file and convert it to a dictionary

30 Python: 5 Ways to Check if a Dictionary is Empty

31 Python: How to convert a dictionary to a class object (basic and advanced examples)

32 Python: How to Get a Random Value from a Dictionary

33 Python: Using dataclass to create dictionary-like object

34 Python Error: 'dictionary update sequence element #0 has length X; 2 is required'

35 Python Error: 'dict' object has no attribute 'append'

36 Python Error: 'dict' object has no attribute 'iteritems'

37 Python: How to get a random item from a dictionary

38 Python: How to Pretty Print a Deeply Nested Dictionary (Basic and Advanced Examples)

39 Python RuntimeError: directory changed during iteration

40 Python: How to get the first/last item from a dictionary

41 Python: Passing a dictionary as a function argument

42 Python: How to find the difference between 2 dictionaries

43 Set and FrozenSet in Python: What's the difference?

44 5 ways to create a set in Python

45 Python: Checking if a dict is a subset of another dict

46 Python: How to compare 2 sets

47 Python - Set Union and Intersection (basic and advanced examples)

48 Python Set - symmetric_difference_update() method

49 Python Set - difference_update() method (examples)

50 Python: How to convert a set to a list and vice-versa

51 5 tricks to maintain the order in a set in Python

52 Python: How to add new elements to an existing set (4 ways)

53 Python: How to get an element from a set

54 Python: How to find the intersection of N sets

55 5 ways to create a tuple in Python

56 Range Type in Python: The Ultimate Guide (with Examples)

57 Python: Checking if 2 ranges overlap (4 examples)

58 Working with named tuples in Python (basic and advanced examples)

59 How to compare 2 tuples in Python (basic and advanced)

60 How to sort a list of tuples in Python (basic and advanced examples)

61 Python: How to convert a list to a tuple and vice-versa

62 Python: Using type hints with tuples (basic and advanced examples)

63 Python: How to create a new tuple from 2 existing tuples (basic and advanced examples)

64 Python: Combine N lists to a single list of tuples

65 Python: How to unzip a list of tuples to flat lists

66 How to filter a list of tuples in Python (5 ways)

67 Python: Counting the occurrences of elements in a tuple

68 Python: How to convert a list of tuples to a dict

69 Python: Typing a list of tuples for consistent data structure

70 Python: How to convert a tuple to a string and vice versa

71 4 ways to loop through a tuple in Python

72 Python: How to use aliases to access returned values from a function that returns a tuple

73 Python - How to unpack a tuple Pythonically

74 2 Ways to Create an Empty Tuple in Python

75 Python: How to Convert a Dictionary to a Query String

76 Python: Define Generic Types for Lists of Nested Dictionaries

77 Python: Using type hints with NamedTuple – Examples

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments