Loading video player…

Python Basics Exercises: Modules and Packages (Overview)

In Python Basics: Modules and Packages, you learned how to build an application by putting related code into separate files called modules. You also used the import statement to use modules in another file.

In this video course, you’ll practice:

  • Creating your own modules
  • Using modules in another file through the import statement
  • Organizing several modules into a package with __init__.py

Along the way, you’ll also get some insight into how to tackle coding challenges in general, which can be a great way to level up as a developer.

This video course is part of the Python Basics series, which accompanies Python Basics: A Practical Introduction to Python 3. You can also check out the other Python Basics courses.

Note that you’ll be using IDLE to interact with Python throughout this course. If you’re just getting started, then you might want to check out Python Basics: Setting Up Python before diving into this course.


Sample Code (.zip)

4.4 KB

Course Slides (.pdf)

4.2 MB

00:00 Hi, I’m Philipp with Real Python, and I’m so excited that you’re joining me today on this very special course. In this Real Python Exercise course, you’ll practice building modules and packages.

00:12 Our exercises courses are all about training. You’ll train the process of writing code by solving carefully selected exercises. You’ll also train reading over other people’s code and communicating your thought process.

00:26 Doing all that, you’ll practice the concepts that you’ve learned about in an associated course or tutorial and help make them stick. In the upcoming lessons, I’ll introduce you to tasks, give you an opportunity to solve them yourself, and then show you step by step how I solved each of them.

00:44 You’ll go through three steps for each task. You’ll learn about the exercise, code your own solution, and then you’ll compare your solution with mine.

00:55 When I walk you through a task, I’ll explain what I do and also why I do it like that. That will give you a chance to compare not just our final solution, but also how we got there.

01:07 And this is how the course is structured. You’ll start with solving some review exercises in the first section, and then slowly build up towards a proper challenge.

01:17 Before starting this course, you should have watched the Python Basics course on modules and packages. If you went through that course, then you are well equipped to solve the tasks that I’ll throw at you. The concepts that you’ll practice are creating your own modules, using modules in another file via the import statement, and organizing several modules into a package.

01:40 If you are somewhat familiar with these concepts and you want to fortify your knowledge with practical programming tasks, then this course is exactly right for you.

01:50 Before you get started, there’s another tiny bit of background for this course, which is that I’ll use IDLE, the Integrated Development and Learning Environment that comes bundled with Python.

02:01 If you’ve gone through the Python Basics courses, then you are already familiar with the tool. If not, then you can check out these associated courses that cover getting started with IDLE.

02:12 If you are just here to train and you are familiar with other code editors, then feel free to use whatever tool you like to solve the upcoming coding tasks.

02:21 And that’s all there is to say to get you set up. If you’re ready to get started and do some hands-on programming, then see you in the next lesson. And there I’ll introduce you to the first exercise to get you warmed up.

Become a Member to join the conversation.