In this series of liveProjects, you'll work out your Python skills and form sound mental models of fundamental aspects of Python. Cracking these simple challenges will improve your ability to effectively reason about Python code, and speed up your mastery of the language.
These projects are designed for learning purposes and are not complete, production-ready applications or solutions.
here's what's included
Project 1 Variables
In this liveProject, you’ll help out a new Python developer with some mysterious bugs in their code. To unravel their issues, you’ll explore two different models for the behavior of Python variables and write some code that will either support or refute those models. This will help you reason about how variables behave in Python in regards to both mutable and immutable objects.
Project 2 Objects and Methods
In this liveProject, you’ll take on the task of extending a pricing application. You’ve just hit your first speed bump of needing to add functionality to the class that manages prices. However, that class is used elsewhere and you can’t get permission to change it. Your challenge is to implement a “monkey patch”—adding methods to the class at runtime—by experimenting with Python-bound methods.
Project 3 Class Methods and Variables
In this liveProject, you’ll write a Python class to manage network connections to your server. You want your class to track the port number and the connections, but instance data is, by definition, not associated with your class. Your challenge is to explore and determine the best ways to associate data with a class and learn how to use a class method.
Project 4 Inheritance
In this liveProject, you’ll explore how inheritance works in Python through developing classes that might be used in a simple video game. Your game follows animal characters moving through an obstacle course, with different movement styles for wolves, bears, eagles, ducks, frogs, and trout. In order to avoid having to repeat your code between characters, you’ll create some base classes and inherit from them. You’ll see how to inherit from more than one class at a time, and discover use cases for multiple inheritance.
Project 5 Iteration
In this liveProject, you’ll experiment with how iteration works in Python. You’re building a data analysis program that needs to iterate over a given number of Fibonacci numbers. To help out, you’ll construct an object that can be iterated over in a for loop or list comprehension that provides the Fibonacci series.
This liveProject is for both new and experienced Python programmers who want to improve their understanding of the language. To begin this liveProject you will need to be familiar with:
- Python “shell” such as Jupyter Notebook
- Basics of Python variables
- Creating variables
- Defining a function
- Defining a class
- Using __dict__ and dir() to inspect Python objects
- Basic exceptions
you will learn
In this liveProject series, you’ll master fundamental Python concepts and techniques that will help you grow as a Python programmer.
- Mental Models to help decide how to approach and solve a problem
- Variables as containers
- Variables as labels
- Using the id() function
- the __dict__ attribute to look at an instance’s attributes
- the dir() function to see all of the attributes an object has
- the type() function to both get the class of an object and to create a class
- Defining a __repr__ method to display instance data
- Experimenting with immutable and mutable class attributes
- Using the @classmethod decorator to create class methods
- Python’s system of inheritance
- The Python iteration protocol
- Creating an iterable
- Creating an iterator
- Using a generator function to create an iterator