Python Tutorial
Python Tutorial
Learn Python step by step with hands-on, checked-against-the-real-interpreter exercises.
Python is one of the most widely used languages for scripting, data work, and backend services — but going from "I can read Python" to "I can write it fluently" takes hands-on reps with lists, dicts, comprehensions, and the control-flow basics.
This tutorial builds up from print() and variables to comprehensions, dictionaries, exceptions, and generators, finishing with a capstone that combines them. Each step gives you setup code and a goal; you write the exercise and we run it through a real Python interpreter (Pyodide, right in your browser) to check your output.
What you'll practice (18 steps)
- print() and variables
- f-string number formatting
- Lists: indexing
- Lists: slicing
- List comprehension: transform
- List comprehension: filter
- Dictionaries: access and get()
- Dictionaries: iterate items()
- Conditionals: if / elif / else
- Loops: for with range()
- Loops: while and break
- Functions: def and return
- String methods: split, strip, join
- Sorting: sorted() with a key
- Exception handling: try / except
- Nested data: sum over a list of dicts
- Generators: yield
- Capstone: put it together