Beginner Python Exercises
Here are some enjoyable Python Exercises for you to solve! We strive to offer a huge selection of Python Exercises so you can internalize Python Concepts through these exercises.
Among these Python Exercises you can find the most basic Python Concepts about Python Syntax and built-in functions and methods.
Holy Python is reader-supported. When you buy through links on our site, we may earn an affiliate commission.
Choose the topics you'd like to practice from our extensive exercise list.
Python Beginner Exercises consist of some 125+ exercises that can be solved by beginners coders and newcomers to Python world.
Majority of the exercises are online and interactive which offers an easier and convenient entry point for beginners.
First batch of the exercises starts with print function as a warm up but quickly it becomes all about data.
You can start exercising with making variable assignments and move on to most fundamental data types in Python:
Exercise 1: print() function | (3) : Get your feet wet and have some fun with the universal first step of programming.
Exercise 2: Variables | (2) : Practice assigning data to variables with these Python exercises.
Exercise 3: Data Types | (4) : Integer (int), string (str) and float are the most basic and fundamental building blocks of data in Python.
Exercise 4: Type Conversion | (8) : Practice converting between basic data types of Python when applicable.
Exercise 5: Data Structures | (6) : Next stop is exercises of most commonly used Python Data Structures. Namely;
- Dictionaries and
- Strings are placed under the microscope.
Exercise 6: Lists | (14) : It’s hard to overdo Python list exercises. They are fun and very fundamental so we prepared lots of them. You will also have the opportunity to practice various Python list methods.
Exercise 7: Tuples | (8) : Python Tuples Exercises with basic applications as well as common tuples methods
Exercise 8: Dictionaries | (11) : Practice with Python Dictionaries and some common dictionary methods.
Exercise 9: Strings | (14) : Basic string operations as well as many string methods can be practiced through 10+ Python String Exercises we have prepared for you.
Next batch consist of some builtin Python functions and Python methods. The difference between function and method in Python is that functions are more like standalone blocks of codes that take arguments while methods apply directly on a class of objects.
That’s why we can talk about list methods, string methods, dictionary methods in Python but functions can be used alone as long as appropriate arguments are passed in them.
Exercise 10: len() function | (5) : Python’s len function tells the length of an object. It’s definitely a must know and very useful in endless scenarios. Whether it’s manipulating strings or counting elements in a list, len function is constantly used in computer programming.
Exercise 11: .sort() method | (7) : Practice sort method in Beginner Python Exercises and later on you’ll have the opportunity practice sorted function in Intermediate Python Exercises.
Exercise 12: .pop() method | (3) : A list method pop can be applied to Python list objects. It’s pretty straightforward but actually easy to confuse. These exercises will help you understand pop method better.
Exercise 13: input() function | (6) : Input function is a fun and useful Python function that can be used to acquire input values from the user.
Exercise 14: range() function | (5) : You might want to take a real close look at range function because it can be very useful in numerous scenarios.
These range exercises offer an opportunity to get a good practice and become proficient with the usage of Python’s range function.
Exercise 15: Error Handling | (7) : Error Handling is a must know coding skill and Python has some very explanatory Error Codes that will make a coder’s life easier if he/she knows them!
Exercise 16: Defining Functions | (9) : Practicing user defined Python functions will take your programming skills to the next step. Writing functions are super useful and fun. It makes code reusable too.
Exercise 17: Python Slicing Notation | (8) : Python’s slicing notations are very interesting but can be confusing for beginner coders. These exercises will help you master them.
Exercise 18: Python Operators | (6) : Operators are another fundamental concept. We have prepared multiple exercises so they can be confident in using Python Operators.
FREE ONLINE PYTHON COURSES
Choose from over 100+ free online Python courses.
Thank you for checking out our Python programming content. All of the Python lessons and exercises we provide are free of charge. Also, majority of the Python exercises have an online and interactive interface which can be helpful in the early stages of learning computer programming.
However, we do recommend having a local Python setup on your computer as soon as possible. Anaconda is another free distribution and an comes as a complete package with lots of libraries and useful software (such as Spyder IDE and Jupyter Notebook) You can check out this: simple Anaconda installation tutorial.