Python basics

    A free, hands-on introduction to Python. Short lessons, with exercises you run and check right in your browser. No account needed. Your progress is saved in this browser.

    1. 1Your first programPrint text to the screen, add comments, and read your first error message.
    2. 2Variables and numbersStore values in variables and do maths with whole numbers and decimals.
    3. 3Working with textJoin strings, build messages with f-strings, and pick out letters.
    4. 4Asking for inputRead what the user types with input() and turn it into numbers.
    5. 5Making decisionsUse if, elif and else to run different code in different situations.
    6. 6Repeating with loopsRepeat work with for and while loops, and know when to stop.
    7. 7ListsKeep many values in order, then add, remove, sort and loop over them.
    8. 8DictionariesLook values up by name, like words in a dictionary.
    9. 9FunctionsPackage code into reusable functions with parameters and return values.
    10. 10Handling errorsCatch problems with try and except so programs do not crash.
    11. 11Files and modulesRead and write files, and use Python's standard library.
    12. 12Final project: number gamePut it all together to build a complete guessing game.