Python Foundations

  • Stages: 13
  • Articles: 18
  • Examples: 59
  • 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
    2. 2 Article: How to Start Programming in Python Fast
    3. 3 Article: Online Python Editor Optional
    4. 4 Example: First Program - Hello Space
    5. 5 Example: Comments in Code
    6. 6 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. 7 Article: Python print() Function
    2. 8 Example: Print Function Basics
    3. 9 Example: Text Formatting with f-strings
    4. 10 Example: Print Parameters sep and end
    5. 11 Example: Special Characters in Print
    6. 12 Quiz: Python print() Quiz
  3. Stage 3

    Cargo hold: variables and types

    Store data in variables and learn the basic data types.

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

    Navigation math

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

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

    Signal decoding: strings

    Join, slice, search and change text.

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

    Decision engine: if/elif/else

    Let your program choose what to do.

    1. 31 Article: Python If/Else for Beginners
    2. 32 Example: Basic if Statement
    3. 33 Example: If-else Statement
    4. 34 Example: If-elif-else Statement
    5. 35 Example: Logical Operators and, or, not
    6. 36 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. 37 Example: Creating Lists
    2. 38 Example: List Indexing and Modification
    3. 39 Example: List Methods - append, insert, pop
    4. 40 Example: Sorting and Reversing Lists
    5. 41 Quiz: Python Lists Quiz
    6. 42 Example: Creating Tuples
    7. 43 Example: Tuple Unpacking
    8. 44 Example: Tuples vs Lists - Differences
    9. 45 Example: Tuple Methods count and index
    10. 46 Quiz: Python Tuples Quiz
  8. Stage 8

    Orbits: loops

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

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

    Star catalogue: dictionaries and sets

    Look data up by key and work with unique values.

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

    Mission modules: functions

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

    1. 65 Article: Python Functions for Beginners
    2. 66 Example: Creating Simple Functions
    3. 67 Example: Functions with Parameters
    4. 68 Example: Default Parameter Values
    5. 69 Example: Documenting Functions
    6. 70 Example: Return Statement Basics
    7. 71 Example: Returning Multiple Values
    8. 72 Example: Early Exit from Function
    9. 73 Example: Returning Dictionary or List
    10. 74 Quiz: Python Return Values Quiz
    11. 75 Article: Converting Temperatures in Python
    12. 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