Python Foundations

  • Stages: 13
  • Articles: 17
  • Examples: 60
  • Quizzes: 19
  • Beginner

Everything you need to go from your first print() to writing your own functions, in the order that makes sense. Each stage mixes a short article, runnable examples you can edit in the browser and a quiz to check what stuck.

  1. Stage 1

    Pre-flight

    Install Python, meet the online editor and run your first program.

    1. 1 Article: A Practical Guide to Getting Started with Programming Optional
    2. 2 Article: How to Start Programming in Python Fast
    3. 3 Article: Online Python Editor Optional
    4. 4 Example: Check Python Version
    5. 5 Example: First Program - Hello Space
    6. 6 Example: Comments in Code
    7. 7 Article: Python Books for Beginners Optional
  2. Stage 2

    Mission log: print()

    Show text and numbers on screen, and format them the way you want.

    1. 8 Article: Python print() Function
    2. 9 Example: Print Function Basics
    3. 10 Example: Text Formatting with f-strings
    4. 11 Example: Print Parameters sep and end
    5. 12 Example: Special Characters in Print
    6. 13 Quiz: Python print() Quiz
  3. Stage 3

    Cargo hold: variables and types

    Store data in variables and learn the basic data types.

    1. 14 Article: Variables and data types in Python
    2. 15 Example: Creating Variables
    3. 16 Example: Basic Data Types
    4. 17 Example: Type Conversion
    5. 18 Example: Dynamic Typing
    6. 19 Quiz: Python Variables Quiz
  4. Stage 4

    Navigation math

    Operators, order of operations and reading numbers from the user.

    1. 20 Article: Numbers and Basic Math Operations in Python
    2. 21 Example: Basic Math Operations
    3. 22 Example: Floor Division and Modulo
    4. 23 Example: Exponentiation and Roots
    5. 24 Example: Order of Operations
    6. 25 Quiz: Python Math Operations Quiz
    7. 26 Quiz: Python Type Conversion and input() Quiz
  5. Stage 5

    Signal decoding: strings

    Join, slice, search and change text.

    1. 27 Example: Creating and Joining Strings
    2. 28 Example: String Indexing and Slicing
    3. 29 Example: String Methods - upper, lower, strip
    4. 30 Example: Methods find, count, replace and split
    5. 31 Quiz: Python Strings Quiz
  6. Stage 6

    Decision engine: if/elif/else

    Let your program choose what to do.

    1. 32 Article: Python If/Else for Beginners
    2. 33 Example: Basic if Statement
    3. 34 Example: If-else Statement
    4. 35 Example: If-elif-else Statement
    5. 36 Example: Logical Operators and, or, not
    6. 37 Quiz: Python If/Else Quiz
  7. Stage 7

    Crew roster: lists and tuples

    Keep many values in order, and know when they should never change.

    1. 38 Example: Creating Lists
    2. 39 Example: List Indexing and Modification
    3. 40 Example: List Methods - append, insert, pop
    4. 41 Example: Sorting and Reversing Lists
    5. 42 Quiz: Python Lists Quiz
    6. 43 Example: Creating Tuples
    7. 44 Example: Tuple Unpacking
    8. 45 Example: Tuples vs Lists - Differences
    9. 46 Example: Tuple Methods count and index
    10. 47 Quiz: Python Tuples Quiz
  8. Stage 8

    Orbits: loops

    Repeat work with for and while, and stop exactly when you need to.

    1. 48 Example: For Loop Basics
    2. 49 Example: For Loop with enumerate and range
    3. 50 Quiz: Python For Loop Quiz
    4. 51 Example: While Loop Basics
    5. 52 Example: Break and Continue in Loops
    6. 53 Quiz: Python While Loop Quiz
    7. 54 Article: Nested Loops in Python
  9. Stage 9

    Star catalogue: dictionaries and sets

    Look data up by key and work with unique values.

    1. 55 Example: Creating Dictionaries
    2. 56 Example: Modifying Dictionaries
    3. 57 Example: Iterating Over Dictionary
    4. 58 Example: Nested Dictionaries
    5. 59 Quiz: Python Dictionaries Quiz
    6. 60 Example: Creating Sets
    7. 61 Example: Set Operations
    8. 62 Example: Mathematical Set Operations
    9. 63 Example: Comparing Sets
    10. 64 Quiz: Python Sets Quiz
    11. 65 Quiz: Python Data Types Quiz
  10. Stage 10

    Mission modules: functions

    Package code into functions that take values and give results back.

    1. 66 Example: Creating Simple Functions
    2. 67 Example: Functions with Parameters
    3. 68 Example: Default Parameter Values
    4. 69 Example: Documenting Functions
    5. 70 Example: Return Statement Basics
    6. 71 Example: Returning Multiple Values
    7. 72 Example: Early Exit from Function
    8. 73 Example: Returning Dictionary or List
    9. 74 Quiz: Python Return Values Quiz
    10. 75 Article: Converting Temperatures in Python
    11. 76 Article: Calculate your weight on different planets in Python
  11. Stage 11

    Advanced controls: arguments and scope

    Flexible arguments, and where your variables actually live.

    1. 77 Example: Positional and Keyword Arguments
    2. 78 Example: Variable Number of Arguments *args
    3. 79 Example: Variable Keyword Arguments **kwargs
    4. 80 Example: Combining Different Argument Types
    5. 81 Quiz: Python *args and **kwargs Quiz
    6. 82 Example: Local and Global Variables
    7. 83 Example: The global Keyword
    8. 84 Example: Scope in Nested Functions
    9. 85 Example: Separating Namespaces
    10. 86 Quiz: Python Variable Scope Quiz
    11. 87 Quiz: Python Functions Quiz
  12. Stage 12

    Systems check: modules and errors

    Use code others wrote, and read the error messages Python gives you.

    1. 88 Example: Import System Modules
    2. 89 Article: Python Random Module
    3. 90 Quiz: Python Error Messages Quiz
  13. Stage 13

    Launch

    A final check across the whole path, then real mini projects.

    1. 91 Quiz: Python Basics Quiz
    2. 92 Article: Base 6 Number System in Python
    3. 93 Article: Calculating Escape Velocity in Python
    4. 94 Article: Medical dispenser - Don’t trust the user
    5. 95 Article: Drawing Planetary Orbits in Python Optional
    6. 96 Article: Managing Astronaut Medical Data with Python Optional