← Go Home

Lesson Homepage

Click on any of the lesson to begin or resume your Python journey

Lesson 1 - Intro to python and programming + prereqs.

Prerequisites

Tools: hardware and software

Understanding computers and programming

Introduction to Python

Why python?

Installing python

Windows

Installing git bash
Installing python
Git bash configuration for python
  • Solution #1: running python with winpty
  • Solution #2: creating an alias
  • Solution #3: making a permanent alias
  • Lesson 2 - The Shell

    Overview of the terminal

    Understanding the shell

    Definition and role of the shell
    Types of shells

    Practice - Terminal vs. shell

    Navigation

    Directories
  • Home directory
  • Working (Current) directory
  • Parent directory
  • Relative and absolute paths
  • Absolute paths
  • Relative paths
  • From paths to commands
  • cd
  • ls
  • pwd
  • Downloading

    The curl command
  • Essential usage
  • Advanced features (optional)
  • Options and flags
  • Viewing and editing files

    cat
    nano

    Interactive python shell

    Why it is used
    Activating the python interpreter

    The print function

    Comments

    Running python scripts

    Review project

    Lesson 3 - Data structures

    Introduction to data stuctures and types

    Data structures
    Data types

    Numeric Data types

    Integers (int)
    Floating-point numbers (float)

    Strings

    Basis
    String operations
    Stirng methods

    Boolean values

    Usage
    Truthy and falsey values
    Common uses

    Variables

    Assignment statements
  • Usage
  • Using variables
  • Naming conventions
  • Types of variables
  • Variable scope
  • Variables vs literals

    Variables
    Literals

    Mutable vs immutable types

    Mutable
    Immutable
    Mutable vs immutable

    Concatentation: combining data structures

    String concatentation
    List concatenation
    Tuple concatenation
    General rules and considerations
    Practical usage
    Concatenation vs joining

    Lists

    Basic list operations
  • Creating lists
  • Modifying lists
  • Assigning lists to variables
  • List methods

    Tuples

    Indexing

    Indexing in lists
    Indexing in strings
    Indexing in tuples

    Length

    Length of lists
    Length of strings
    Length of tuples

    Slicing: extract subsets

    Slicing lists
    Slicing strings
    Slicing tuples

    f-strings: formatted string literals

    Syntax of f-strings
    Embedding expressions
    Formatting options
    Expressions in curly braces
    Escape characters and special characters
    Expression evaluation order

    Lesson 4 - Conditional structures: conditional statements

    Introduction to conditional statements

    If, else, and elif statements

    If statement
    Elif statement
    Else statement
    Nested if statements

    Comparison and boolean logic

    Comparisons
    Boolean logic in python
    Combining comparisons and boolean logic

    Modulo operator

    Syntax

    Lesson 5 - Loops

    Introduction to looping constructs

    For loops

    Basic for loop
    For loop with tuples
    Nested for loops

    The range function

    range(stop)
    range(start, stop)
    range(start, stop, step)

    The enumerate function

    While loops

    Loop initialization
    Loop condition
    Loop body
    Infinite loops
    Loop control statement

    Infinite loops

    The break statement

    Usage of break
    Terminating the nearest loop
    Example with for loop
    Example with while loop
    Example with a nested loop

    Compound statements in the python interpreter

    Project Assignment: Mini Calculator

    Lessons 3-5

    Lesson 3 - Data Structures
    Lesson 4 - Conditional Structures: Conditional Statements
    Lesson 5 - Loops
    Objective: Create a Python program that functions as a simple calculator. This project will help you practice the concepts learned in Lessons 3, 4, and 5.

    Lesson 6 - Functions

    Introduction: understanding functions

    Defining and calling a function

    Defining a function
    Function parameters
    Calling a function
    Returning values

    Indentation and syntax in functions

    Indentation in functions
  • Rules for indentation
  • Importance of indentation
  • Syntax in functions
  • Function definition syntax
  • Function call syntax
  • Docstrings
  • Function naming convetions

    Return statemets

    Syntax of the return statement
    Purpose of the return statement
  • Returning multiple values
  • Returning none
  • Exiting a function
  • Conditional returns
  • Function without returns
  • Using returned values
  • Using functions in loops

    Using functions within loops
  • Looping through a sequence with a function
  • Function calls in loop conditions
  • Defining functions inside loops (avoid this)
    Functions that contain loops

    Parameters and arguements

    Parameters
    Arguments
  • Positional arguments
  • Keyword arguments
  • *args
  • **kwargs
  • Combining *args and **kwargs
  • Default parameter values
    Variable-length argument lists
    Unpacking sequences as arguments

    Type conversion functions

    int()
    float()
    str()
    list()
    tuple()
    bool()
    set()

    The input function

    Syntax
    Basic usage
    Converting input to other data types
    Looping
    Default values

    Dictionary

    Creating a dictionary
    Dictionary keys
    Accessing values
    Modifying and adding items
    Removing items
    Dictionary methods
    Dictionary nesting
    Use cases

    Modules and importing

    Modules in python
  • Creating a module
  • Using modules
  • Modules namespaces
  • Importing in python
  • Basic import
  • Alias import
  • Import specific items
  • Relative imports
  • Python's standard library
  • The os module

    Importing the os module
    File and dictioinary operations
    Platform independence
    Security considerations

    Lesson 7 - Error handling and debugging

    Overview

    Common errors

    SyntaxError
    NameError
    TypeError
    IndexError
    KeyError
    AttributeError
    ValueError
    ZeroDivisionError
    ImportError
    FileNotFoundError
    RuntimeError

    Reading and understanding error messages

    Understanding python error messages
    Strategies for reading and understanding errors
    Tips for handling errors
    Line numbers and tracebacks in debugging
    Using tracebacks and line numbers for debugging

    Practice - understanding python errors

    Code style and conventions: pycodestyle

    Key features of pycodestyle
  • Installing pycodestyle
  • Using pycodestyle
  • Error codes
  • Try and except

    Key concepts
    Syntax
    Best practices

    Project Assignment: Text-Based Adventure Games

    Lessons 3-7

    Lesson 3 - Data Structures
    Lesson 4 - Conditional Structures: Conditional Statements
    Lesson 5 - Loops
    Lesson 6 - Functions
    Lesson 7 - Error Handling and Debugging
    Objective: Create a simple text-based adventure game where the player navigates through a story by making choices. The game will present scenarios and ask the player to make decisions that affect the outcome. The adventure includes exploring different locations, interacting with characters, and solving simple puzzles.

    Lesson 8 - Advanced data manipulation

    String manipulation: join, find, and replace

    join()
    find()
    replace()
    split()
    strip()
    Considerations in string manipulation

    Lambda functions

    Characterstics of lambda functions
    Use cases
    Limitations + misconceptions

    Augmented assignment operators

    Types of augmented assignment operators
    Features and benefits

    JSON

    Key features of JSON
    Python JSON module
    Advanced features
    Working with files
    JSON and python equivalents
    Use cases

    Web APIs

    Key concepts
    Python librarise for interacting with web APIs
    Creating web APIs in python
    Best practices using web APIs

    Lesson 9 - Introduction to object-oriented programming

    Object-oriented programming

    Defining a new class

    Objects
    Defining classes

    Using instance-level variables

    Initializers

    The self parameter

    Purpose of self

    Practice - intro to OOP I

    Using class-level variables

    Accessing class-level variables
    Modifying class-level variables

    Inheritance and using super

    Introduction to inheritance
  • Defining a superclass
  • Creating a subclass
  • Using super() to call superclass methods
  • Overriding methods
  • Using super() with __init__
  • Polymorphism and multiple inheritance
  • "Is-a" vs "Has-a"

    "Is-a" relationship
    "Has-a" relationship

    Practice - intro to OOP II

    Project Assignment: Personal Expense Tracker

    Lessons 3-9

    Lesson 3 - Data Structures
    Lesson 4 - Conditional Structures: Conditional Statements
    Lesson 5 - Loops
    Lesson 6 - Functions
    Lesson 7 - Error Handling and Debugging
    Lesson 8 - Error Handling and Debugging
    Lesson 9 - Error Handling and Debugging
    Objective: In this project, students will create a Python application that allows users to track their personal expenses and incomes. The program will enable users to add, list, and categorize their financial transactions, and provide summaries of expenses and incomes.