This repository is a series of Python exercises to let a student gain confidence in the very basics of Python programming.
This gives you everything you need to understand and practice the fundamental concepts of functions and objects in Python. The content is designed to build confidence while introducing essential programming concepts in an accessible, Pythonic way.
- int and Integer
- float and Decimal
- bool and Boolean Logic
- If/Elif/Else statements
- While loops
- For loops
- Strings
- Lists (and basic data structures)
- Object References and Mutability
- Classes and Objects
- Instance Methods (and the self parameter)
- Parameters and Return values of Functions
- Objects nested in other Objects
In each of these topic folders, you will find a Python file named after the topic (e.g., lists.py, booleans.py, classes.py) that you will edit with your solutions to the exercises.
Then, you will run the Python file using python <filename>.py
command or work interactively with the Python REPL.
Get all the tests passing, and move on to another topic in the list.
- Make sure you have Python 3.8+ installed on your system
- Clone this repository
- Navigate to any topic directory
- Read the README.md for instructions
- Edit the Python file (e.g., lists.py, booleans.py) to complete the exercises
- Run
python <filename>.py
to test your solutions (e.g.,python lists.py
) - Or use the Python REPL:
python3 -i <filename>.py
for interactive exploration
- Dynamic typing and when to use type hints
- List comprehensions and generator expressions
- f-string formatting and string methods
- Duck typing and Python's approach to polymorphism
- Pythonic idioms like enumerate, zip, and unpacking
- Exception handling with try/except blocks
- Context managers and the with statement
- Decorators and function manipulation
This course emphasizes writing clean, readable, and efficient Python code following PEP 8 style guidelines.