PYnative

Python Programming

  • Learn Python
    • Python Tutorials
    • Python Basics
    • Python Interview Q&As
  • Exercises
    • Python Exercises
    • C Programming Exercises
    • C++ Exercises
  • Quizzes
  • Code Editor
    • Online Python Code Editor
    • Online C Compiler
    • Online C++ Compiler
Home » Python Exercises » Python Dictionary Exercise with Solutions

Python Dictionary Exercise with Solutions

Updated on: May 30, 2025 | 67 Comments

This Python dictionary exercise helps developers learn and practice dictionary operations.

A Python dictionary is a mutable object that stores data as key-value pairs, with each key separated from its value by a colon (:). Dictionary is the most widely used data structure, and it is necessary to understand its methods and operations.

This Python dictionary exercise contains 20 dictionary coding questions, programs, and challenges to solve.

Solutions and hints are provided for each question, and all solutions have been tested on Python 3.

Also Read:

  • Python Dictionary
  • Python Dictionary Quiz

When you complete each question, you get more familiar with the Python dictionary. Let us know if you have any alternative solutions. It will help other developers.

  • Use Online Code Editor to solve exercise questions.
  • To solve this exercise, refer to the complete guide on Python dictionaries.

Table of contents

  • Exercise 1: Perform basic dictionary operations
  • Exercise 2: Perform dictionary operations
  • Exercise 3: Dictionary from Lists
  • Exercise 4: Clear Dictionary
  • Exercise 5: Merge two Python dictionaries into one
  • Exercise 6: Count Character Frequencies
  • Exercise 7: Access Nested Dictionary
  • Exercise 8: Print the value of key ‘history’ from nested dict
  • Exercise 9: Modify Nested Dictionary
  • Exercise 10: Initialize dictionary with default values
  • Exercise 11: Create a dictionary by extracting the keys from a given dictionary
  • Exercise 12: Delete a list of keys from a dictionary
  • Exercise 13: Check if a value exists in a dictionary
  • Exercise 14: Rename key of a dictionary
  • Exercise 15: Get the key of a minimum value
  • Exercise 16: Change value of a key in a nested dictionary
  • Exercise 17: Invert Dictionary
  • Exercise 18: Sort Dictionary by Keys
  • Exercise 19: Sort Dictionary by Values
  • Exercise 20: Check if All Values are Unique

Exercise 1: Perform basic dictionary operations

Given:

my_dict = {'name': 'Alice', 'age': 35, 'city': 'New York'}Code language: Python (python)

Perform following operations on given dictionary

  1. Add New Key-Value Pair: Add a new key-value pair, 'profession': 'Doctor', to the dictionary and print the updated dictionary.
  2. Modify Value: Change the value of the age key to 40 in the dictionary and print the updated dictionary.
  3. Access Key: Print the value associated with the city key.

Expected Output:

Original dictionary: {'name': 'Alice', 'age': 35, 'city': 'New York'}

Updated dictionary after adding 'profession': {'name': 'Alice', 'age': 35, 'city': 'New York', 'profession': 'Doctor'}

Updated dictionary after modification: {'name': 'Alice', 'age': 40, 'city': 'New York', 'profession': 'Doctor'}

City: New York
+ Hint
  • You can add a new key-value pair to a dictionary by simply assigning a value to a new key using square bracket notation.
  • Same as above you can modify an existing value by assigning a new value to an existing key using square bracket notation.
+ Show Solution
my_dict = {'name': 'Alice', 'age': 35, 'city': 'New York'}

print(f"Original dictionary: {my_dict}")

# Add a new key-value pair
my_dict['profession'] = 'Doctor'
print(f"Updated dictionary after adding 'profession': {my_dict}")

# Modify Value
my_dict['age'] = 40
print(f"Updated dictionary after modification: {my_dict}")

# print key
print('City:', my_dict['city'])Code language: Python (python)

Exercise 2: Perform dictionary operations

Given:

my_dict = {'name': 'Alice', 'age': 35, 'city': 'New York', 'profession': 'Doctor'}Code language: Python (python)

Perform following operations on given dictionary

  1. Remove Key-Value Pair : Remove the profession key-value pair from the dictionary.
  2. Get Items (Key-Value Pairs): Print all key-value pairs (items) in the dictionary.
  3. Check if Key Exists in the dictionary

Expected Output:

Original dictionary: {'name': 'Alice', 'age': 35, 'city': 'New York', 'profession': 'Doctor'}

Updated dictionary after removing 'profession': {'name': 'Alice', 'age': 35, 'city': 'New York'}

Printing all key-value pairs:
name: Alice
age: 35
city: New York

Does 'age' exist? True
+ Hint
  • Use the del keyword to remove a key-value pair from a dictionary by specifying the key.
  • Use dictionary method items(), that returns a view object of all key-value pairs. You can iterate over this view.
  • Use the in keyword is to check for the existence of a key in a dictionary.
+ Show Solution
my_dict = {'name': 'Alice', 'age': 35, 'city': 'New York', 'profession': 'Doctor'}

print(f"Original dictionary: {my_dict}")

# Remove the 'model' key-value pair using del
del my_dict['profession']
print(f"Updated dictionary after removing 'profession': {my_dict}")

print("Printing all key-value pairs:")
for key, value in my_dict.items():
  print(f"{key}: {value}")
  
def check_key_exists(dictionary, key_to_check):
  return key_to_check in dictionary

key1 = 'age'
print(f"Does '{key1}' exist? {check_key_exists(my_dict, key1)}")Code language: Python (python)

Exercise 3: Dictionary from Lists

Write a Python program to convert two Python lists into a dictionary where elements from the first list become keys and elements from the second list become values.

keys = ['Ten', 'Twenty', 'Thirty']
values = [10, 20, 30]Code language: Python (python)

Expected output:

{'Ten': 10, 'Twenty': 20, 'Thirty': 30}
Show Hint

Use the zip() function. This function takes two or more iterables (like list, dict, string), aggregates them in a tuple, and returns it.

Or, Iterate the list using a for loop and range() function. In each iteration, add a new key-value pair to a dict using the update() method

Show Solution

Solution 1: The zip() function and a dict() constructor

  • Use the zip(keys, values) to aggregate two lists.
  • Wrap the result of a zip() function into a dict() constructor.
keys = ['Ten', 'Twenty', 'Thirty']
values = [10, 20, 30]

res_dict = dict(zip(keys, values))
print(res_dict)Code language: Python (python)

Solution 2: Using a loop and update() method of a dictionary

keys = ['Ten', 'Twenty', 'Thirty']
values = [10, 20, 30]

# empty dictionary
res_dict = dict()

for i in range(len(keys)):
    res_dict.update({keys[i]: values[i]})
print(res_dict)Code language: Python (python)

Exercise 4: Clear Dictionary

Clear all key-value pairs from a given dictionary and print it.

Given:

my_dict = {'name': 'Alice', 'age': 35, 'city': 'New York'}Code language: Python (python)

Expected Output:

{}
+ Hint

Use dictionary method clear() to remove all items.

+ Show Solution
my_dict = {'name': 'Alice', 'age': 35, 'city': 'New York'}
print(f"dictionary: {my_dict}")

my_dict.clear()
print(f"dictionary after removing all items: {my_dict}")Code language: Python (python)

Exercise 5: Merge two Python dictionaries into one

Write a code to merge two dictionaries into a new dictionary and print it.

Given:

dict1 = {'Ten': 10, 'Twenty': 20, 'Thirty': 30}
dict2 = {'Thirty': 30, 'Fourty': 40, 'Fifty': 50}Code language: Python (python)

Expected output:

{'Ten': 10, 'Twenty': 20, 'Thirty': 30, 'Fourty': 40, 'Fifty': 50}
+ Hint

There are three ways

  1. Using the update() method.
  2. Using the dictionary unpacking operator (** for Python 3.5+)
  3. Simple concatenation with | (Python 3.9+).
Show Solution

Python 3.5+

dict1 = {'Ten': 10, 'Twenty': 20, 'Thirty': 30}
dict2 = {'Thirty': 30, 'Fourty': 40, 'Fifty': 50}

dict3 = {**dict1, **dict2}
print(dict3)Code language: Python (python)

Other Versions

dict1 = {'Ten': 10, 'Twenty': 20, 'Thirty': 30}
dict2 = {'Thirty': 30, 'Fourty': 40, 'Fifty': 50}

dict3 = dict1.copy()
dict3.update(dict2)
print(dict3)Code language: Python (python)

Exercise 6: Count Character Frequencies

Given a string, create a dictionary where keys are characters and values are their frequencies in the string.

Given:

string1 = 'Jessa'Code language: Python (python)

Expected Output:

Frequencies for 'Jessa': {'J': 1, 'e': 1, 's': 2, 'a': 1}
+ Hint
  • First, iterate through each character in the string using for loop.
  • For each character, check if it’s already a key in your frequency dictionary using get() method. If it is, increment its count; otherwise, add it as a new key with a count of 1.
+ Show Solution
def count_char_frequencies(input_string):
  frequency_dict = {}
  for char in input_string:
    # Use get() method: if char is in dict, get its value; otherwise, default to 0
    frequency_dict[char] = frequency_dict.get(char, 0) + 1
  return frequency_dict

string1 = 'Jessa'
print(f"Frequencies for '{string1}': {count_char_frequencies(string1)}")Code language: Python (python)

Exercise 7: Access Nested Dictionary

Given a nested dictionary {'person': {'name': 'Alice', 'age': 30}}, print Alice’s age.

Given:

data = {'person': {'name': 'Alice', 'age': 30}}Code language: Python (python)

Expected Output:

Alice's age is: 30
+ Hint

To access values in a nested dictionary, you use multiple sets of square brackets, chaining the key lookups for each level of nesting.

+ Show Solution
nested_person_dict = {'person': {'name': 'Alice', 'age': 30}}
print(f"Nested dictionary: {nested_person_dict}")

# Access Alice's age
# 1. Access the 'person' key to get the inner dictionary
# 2. Access the 'age' key within that inner dictionary
alices_age = nested_person_dict['person']['age']

print(f"Alice's age is: {alices_age}")Code language: Python (python)

Explanation:

  • nested_person_dict['person']: This accesses the inner dictionary associated with the key 'person'.
  • ['age']: This then accesses the 'age' key within that inner dictionary.
  • = 31: Finally, this assigns the new value 31 to the 'age' key.

Exercise 8: Print the value of key ‘history’ from nested dict

sampleDict = {
    "class": {
        "student": {
            "name": "Mike",
            "marks": {
                "physics": 70,
                "history": 80
            }
        }
    }
}
Code language: Python (python)

Expected output:

80

Show Hint

It is a nested dict. Use the correct chaining of keys to locate the specified key-value pair.

Show Solution
sampleDict = {
    "class": {
        "student": {
            "name": "Mike",
            "marks": {
                "physics": 70,
                "history": 80
            }
        }
    }
}

# understand how to located the nested key
# sampleDict['class'] = {'student': {'name': 'Mike', 'marks': {'physics': 70, 'history': 80}}}
# sampleDict['class']['student'] = {'name': 'Mike', 'marks': {'physics': 70, 'history': 80}}
# sampleDict['class']['student']['marks'] = {'physics': 70, 'history': 80}

# solution
print(sampleDict['class']['student']['marks']['history'])
Code language: Python (python)

Exercise 9: Modify Nested Dictionary

In the below dictionary, change name to ‘Jessa’.

Given:

nested_student_dict = {
    "class": {
        "student": {
            "name": "Mike",
            "marks": {
                "physics": 70,
                "history": 80
            }
        }
    }
}Code language: Python (python)

Expected Output:

nested_student_dict = {
"class": {
"student": {
"name": "Jessa",
"marks": {
"physics": 70,
"history": 80
}
}
}
}
+ Hint

Use chained square bracket notation to reach the specific value you want to modify, then assign a new value to it.

+ Show Solution
nested_student_dict = {
    "class": {
        "student": {
            "name": "Mike",
            "marks": {
                "physics": 70,
                "history": 80
            }
        }
    }
}
print(f"Nested dictionary: {nested_student_dict}")
nested_student_dict['class']['student']['name'] = 'Jessa'

print(f"Dict after modification: {nested_student_dict}")Code language: Python (python)

Exercise 10: Initialize dictionary with default values

In Python, we can initialize the keys with the same values.

Given:

employees = ['Kelly', 'Emma']
defaults = {"designation": 'Developer', "salary": 8000}Code language: Python (python)

Expected output:

{'Kelly': {'designation': 'Developer', 'salary': 8000}, 'Emma': {'designation': 'Developer', 'salary': 8000}}
Show Hint

Use the fromkeys() method of dict.

Show Solution

The fromkeys() method returns a dictionary with the specified keys and the specified value.

employees = ['Kelly', 'Emma']
defaults = {"designation": 'Developer', "salary": 8000}

res = dict.fromkeys(employees, defaults)
print(res)

# Individual data
print(res["Kelly"])Code language: Python (python)

Exercise 11: Create a dictionary by extracting the keys from a given dictionary

Write a Python program to create a new dictionary by extracting the mentioned keys from the below dictionary.

Given dictionary:

sample_dict = {
    "name": "Kelly",
    "age": 25,
    "salary": 8000,
    "city": "New york"}

# Keys to extract
keys = ["name", "salary"]Code language: Python (python)

Expected output:

{'name': 'Kelly', 'salary': 8000}
Show Hint
  • Iterate the mentioned keys using a loop
  • Next, check if the current key is present in the dictionary, if it is present, add it to the new dictionary
Show Solution

Solution 1: Dictionary Comprehension

sampleDict = { 
  "name": "Kelly",
  "age":25, 
  "salary": 8000, 
  "city": "New york" }

keys = ["name", "salary"]

newDict = {k: sampleDict[k] for k in keys}
print(newDict)Code language: Python (python)

Solution 2: Using the update() method and loop

sample_dict = {
    "name": "Kelly",
    "age": 25,
    "salary": 8000,
    "city": "New york"}

# keys to extract
keys = ["name", "salary"]

# new dict
res = dict()

for k in keys:
    # add current key with its va;ue from sample_dict
    res.update({k: sample_dict[k]})
print(res)Code language: Python (python)

Exercise 12: Delete a list of keys from a dictionary

Given:

sample_dict = {
    "name": "Kelly",
    "age": 25,
    "salary": 8000,
    "city": "New york"
}

# Keys to remove
keys = ["name", "salary"]Code language: Python (python)

Expected output:

{'city': 'New york', 'age': 25}
Show Hint
  • Iterate the mentioned keys using a loop
  • Next, check if the current key is present in the dictionary, if it is present, remove it from the dictionary

To achieve the above result, we can use the dictionary comprehension or the pop() method of a dictionary.

Show Solution

Solution 1: Using the pop() method and loop

sample_dict = {
    "name": "Kelly",
    "age": 25,
    "salary": 8000,
    "city": "New york"
}
# Keys to remove
keys = ["name", "salary"]

for k in keys:
    sample_dict.pop(k)
print(sample_dict)Code language: Python (python)

Solution 2: Dictionary Comprehension

sample_dict = {
    "name": "Kelly",
    "age": 25,
    "salary": 8000,
    "city": "New york"
}
# Keys to remove
keys = ["name", "salary"]

sample_dict = {k: sample_dict[k] for k in sample_dict.keys() - keys}
print(sample_dict)Code language: Python (python)

Exercise 13: Check if a value exists in a dictionary

While we know how to check for a key’s presence in a dictionary, it’s sometimes necessary to determine if a specific value exists.

Write a Python program to check if the value 200 is present in the provided dictionary.

Given:

sample_dict = {'a': 100, 'b': 200, 'c': 300}Code language: Python (python)

Expected output:

200 present in a dict
Show Hint
  • Get all values of a dict in a list using the values() method.
  • Next, use the if condition to check if 200 is present in the given list
Show Solution
sample_dict = {'a': 100, 'b': 200, 'c': 300}
if 200 in sample_dict.values():
    print('200 present in a dict')Code language: Python (python)

Exercise 14: Rename key of a dictionary

Write a program to rename a key city to a location in the following dictionary.

Given:

sample_dict = {
  "name": "Kelly",
  "age":25,
  "salary": 8000,
  "city": "New york"
}Code language: Python (python)

Expected output:

{'name': 'Kelly', 'age': 25, 'salary': 8000, 'location': 'New york'}
Show Hint
  • Remove the city from a given dictionary
  • Add a new key (location) into a dictionary with the same value
Show Solution
sample_dict = {
    "name": "Kelly",
    "age": 25,
    "salary": 8000,
    "city": "New york"
}

sample_dict['location'] = sample_dict.pop('city')
print(sample_dict)Code language: Python (python)

Exercise 15: Get the key of a minimum value

Write a code to print the key of a minimum value from the following dictionary.

sample_dict = {
  'Physics': 82,
  'Math': 65,
  'history': 75
}Code language: Python (python)

Expected output:

Math

Show Hint

Use the built-in function min()

Show Solution
sample_dict = {
    'Physics': 82,
    'Math': 65,
    'history': 75
}
print(min(sample_dict, key=sample_dict.get))Code language: Python (python)

Exercise 16: Change value of a key in a nested dictionary

Write a Python program to change Brad’s salary to 8500 in the following dictionary.

Given:

sample_dict = {
    'emp1': {'name': 'Jhon', 'salary': 7500},
    'emp2': {'name': 'Emma', 'salary': 8000},
    'emp3': {'name': 'Brad', 'salary': 500}
}Code language: Python (python)

Expected output:

{
   'emp1': {'name': 'Jhon', 'salary': 7500},
   'emp2': {'name': 'Emma', 'salary': 8000},
   'emp3': {'name': 'Brad', 'salary': 8500}
}
Show Solution
sample_dict = {
    'emp1': {'name': 'Jhon', 'salary': 7500},
    'emp2': {'name': 'Emma', 'salary': 8000},
    'emp3': {'name': 'Brad', 'salary': 6500}
}

sample_dict['emp3']['salary'] = 8500
print(sample_dict)Code language: Python (python)

Exercise 17: Invert Dictionary

Write a code to swap keys and values in a dictionary. Assume all values are unique

Given:

original_dict1 = {'a': 1, 'b': 2, 'c': 3}Code language: Python (python)

Expected Output:

Original dictionary 1: {'a': 1, 'b': 2, 'c': 3}
Inverted dictionary 1: {1: 'a', 2: 'b', 3: 'c'}
+ Hint
  • Remember that list indices start from 0. So, the third element will be at index 2. Use indexing to get a specific element.
  • Use the len() function to get the number of elements.
  • An empty list has a length of 0.
+ Show Solution
def invert_dictionary(input_dict):
  inverted_dict = {}
  # iterates through each key-value pair in the input_dict
  for key, value in input_dict.items():
    inverted_dict[value] = key
  return inverted_dict

original_dict1 = {'a': 1, 'b': 2, 'c': 3}

print(f"Original dictionary 1: {original_dict1}")
print(f"Inverted dictionary 1: {invert_dictionary(original_dict1)}")Code language: Python (python)

inverted_dict[value] = key: Inside the loop, for each pair, we take the value from the original dictionary and use it as the new key in inverted_dict, and the original key becomes its new value. This effectively swaps them.

Exercise 18: Sort Dictionary by Keys

Sort a dictionary by its keys and print the sorted dictionary (as an OrderedDict or by converting to a list of tuples).

Given:

my_dict = {'apple': 3, 'zebra': 1, 'banana': 2, 'cat': 4}Code language: Python (python)

Expected Output:

Original dictionary: {'apple': 3, 'zebra': 1, 'banana': 2, 'cat': 4}

Sorted by keys (as OrderedDict):
OrderedDict([('apple', 3), ('banana', 2), ('cat', 4), ('zebra', 1)])
+ Hint

You can get the keys, sort them, and then build a new dictionary or list of tuples.

+ Show Solution
from collections import OrderedDict

my_dict = {'apple': 3, 'zebra': 1, 'banana': 2, 'cat': 4}
print(f"Original dictionary: {my_dict}")

# Method 1: Create an OrderedDict (maintains insertion order, good for sorted views)
# In Python 3.7+, dicts already preserve insertion order, so this might be redundant
# if you just create a new dict from sorted items.
print("\nSorted by keys (as OrderedDict):")
sorted_by_key_ordered_dict = OrderedDict(sorted(my_dict.items()))
print(sorted_by_key_ordered_dict)

# Method 2: Convert to a list of (key, value) tuples, sorted by key
print("\nSorted by keys (as list of tuples):")
sorted_list_of_tuples = sorted(my_dict.items())
print(sorted_list_of_tuples)Code language: Python (python)

Explanation:

  • my_dict_for_key_sort.items(): Gives us a list of (key, value) tuples.
  • sorted(...): Sorts this list of tuples. By default, sorted() sorts tuples based on their first element (the key in this case).
  • OrderedDict(...): Creates an OrderedDict from these sorted tuples. An OrderedDict remembers the order in which items were inserted.

Or sorted(my_dict_for_key_sort.items()): This directly sorts the (key, value) tuples, giving you a list of tuples sorted by keys.

Exercise 19: Sort Dictionary by Values

Sort a dictionary by its values and print the sorted dictionary (as an OrderedDict or by converting to a list of tuples).

Given:

my_dict = {'Jessa': 3, 'Kelly': 1, 'Jon': 2, 'Kerry': 4, 'Joy': 1}Code language: Python (python)

Expected Output:

Original dictionary: {'Jessa': 3, 'Kelly': 1, 'Jon': 2, 'Kerry': 4, 'Joy': 1}

Sorted by values (as OrderedDict):
OrderedDict([('Jessa', 3), ('Kelly', 1), ('Jon', 2), ('Kerry', 4), ('Joy', 1)])
+ Hint

Use sorted() on the dictionary’s items, you’ll need to provide a key argument to sorted() to tell it to sort based on the second element of each (key, value) tuple (which is the value). You can use lambda function for this.

+ Show Solution
from collections import OrderedDict

my_dict = {'Jessa': 3, 'Kelly': 1, 'Jon': 2, 'Kerry': 4, 'Joy': 1}
print(f"Original dictionary: {my_dict}")

# Method 1: Create an OrderedDict sorted by values
print("\nSorted by values (as OrderedDict):")
sorted_by_value_ordered_dict = OrderedDict(my_dict)
print(sorted_by_value_ordered_dict)

# Method 2: Convert to a list of (key, value) tuples, sorted by value
print("\nSorted by values (as list of tuples):")
print(my_dict)Code language: Python (python)

Exercise 20: Check if All Values are Unique

Write a function that takes a dictionary and returns True if all values in the dictionary are unique, False otherwise.

Given:

dict1 = {'a': 1, 'b': 2, 'c': 3}             # All values unique
dict2 = {'x': 10, 'y': 20, 'z': 10}          # Value 10 is duplicated
dict3 = {} # Empty dictionary (all values are vacuously unique)Code language: Python (python)

Expected Output:

Dictionary: {'a': 1, 'b': 2, 'c': 3} -> All values unique? True
Dictionary: {'x': 10, 'y': 20, 'z': 10} -> All values unique? False
Dictionary: {} -> All values unique? True
+ Hint

sets are excellent for checking uniqueness. You can extract all the values from the dictionary and then see if the number of values is the same as the number of unique values (i.e., the size of a set created from those values).

+ Show Solution
def are_all_values_unique(input_dict):
  # Get all values from the dictionary
  all_values = list(input_dict.values())

  # Convert the list of values to a set to get only unique values
  unique_values_set = set(all_values)

  # If the length of the original values list is equal to the length of the unique values set,
  # it means all values were unique.
  return len(all_values) == len(unique_values_set)

# Test cases
dict1 = {'a': 1, 'b': 2, 'c': 3}             # All values unique
dict2 = {'x': 10, 'y': 20, 'z': 10}          # Value 10 is duplicated
dict3 = {} # Empty dictionary (all values are vacuously unique)

print(f"Dictionary: {dict1} -> All values unique? {are_all_values_unique(dict1)}")
print(f"Dictionary: {dict2} -> All values unique? {are_all_values_unique(dict2)}")
print(f"Dictionary: {dict3} -> All values unique? {are_all_values_unique(dict3)}")Code language: Python (python)

Filed Under: Python, Python Basics, Python Exercises

Did you find this page helpful? Let others know about it. Sharing helps me continue to create free Python resources.

TweetF  sharein  shareP  Pin

About Vishal

Image

I’m Vishal Hule, the Founder of PYnative.com. As a Python developer, I enjoy assisting students, developers, and learners. Follow me on Twitter.

Related Tutorial Topics:

Python Python Basics Python Exercises

All Coding Exercises:

C Exercises
C++ Exercises
Python Exercises

Python Exercises and Quizzes

Free coding exercises and quizzes cover Python basics, data structure, data analytics, and more.

  • 15+ Topic-specific Exercises and Quizzes
  • Each Exercise contains 25+ questions
  • Each Quiz contains 25 MCQ
Exercises
Quizzes

Loading comments... Please wait.

In: Python Python Basics Python Exercises
TweetF  sharein  shareP  Pin

  Python Exercises

  • All Python Exercises
  • Basic Exercise for Beginners
  • Intermediate Python Exercises
  • Input and Output Exercise
  • Loop Exercise
  • Functions Exercise
  • String Exercise
  • Data Structure Exercise
  • List Exercise
  • Dictionary Exercise
  • Set Exercise
  • Tuple Exercise
  • Date and Time Exercise
  • OOP Exercise
  • File Handling Exercise
  • Python JSON Exercise
  • Random Data Generation Exercise
  • NumPy Exercise
  • Pandas Exercise
  • Matplotlib Exercise
  • Python Database Exercise

 Explore Python

  • Python Tutorials
  • Python Exercises
  • Python Quizzes
  • Python Interview Q&A
  • Python Programs

All Python Topics

Python Basics Python Exercises Python Quizzes Python Interview Python File Handling Python OOP Python Date and Time Python Random Python Regex Python Pandas Python Databases Python MySQL Python PostgreSQL Python SQLite Python JSON

About PYnative

PYnative.com is for Python lovers. Here, You can get Tutorials, Exercises, and Quizzes to practice and improve your Python skills.

Follow Us

To get New Python Tutorials, Exercises, and Quizzes

  • Twitter
  • Facebook
  • Sitemap

Explore Python

  • Learn Python
  • Python Basics
  • Python Databases
  • Python Exercises
  • Python Quizzes
  • Online Python Code Editor
  • Python Tricks

Coding Exercises

  • C Exercises
  • C++ Exercises
  • Python Exercises

Legal Stuff

  • About Us
  • Contact Us

We use cookies to improve your experience. While using PYnative, you agree to have read and accepted our:

  • Terms Of Use
  • Privacy Policy
  • Cookie Policy

Copyright © 2018–2026 pynative.com

Advertisement