Python, by Running It

The language every other track assumes. Real code, run in your browser, from your first print to your first functions.

46 modules Free, no login Updated 21 October 2026

About this track

Every other track on this site writes Python in its examples, and every one of them assumes you already speak it. This is where you learn it - not from reading, but from running. Every module embeds a real Python interpreter, so the code on the page is not a screenshot: you can change it and press Run and see what actually happens.

The track starts at your first print statement and works up through variables, numbers, strings, lists, conditionals and functions - the handful of ideas every later module leans on.

Every page runs real Python in the browser, with no installation and no setup. The code on screen is the code that executes, so an error you cause is a real traceback rather than a description of one.

What you will be able to do

How the track is ordered

The track starts at your first print statement and adds one idea at a time: variables and types, numbers and operators, strings and slicing, lists and indexing, booleans and comparisons, conditionals, loops, dictionaries, and functions. It ends on reading errors, which is the skill that makes everything else self-teachable. Nothing is assumed - not a prior language, not an installed interpreter, not a terminal.

Where this leads

Every other track on this site writes Python in its examples and assumes you can read it. Once functions and dictionaries are comfortable, the algorithms track is the natural next step, since its data structure pages are the same objects examined more carefully.

All 46 modules, in teaching order

  1. 01Hello, Python!Write your first print statement in a real in-browser Python interpreter and watch strings, numbers and newlines come out the other side.
  2. 02input() and OutputRead user input with input(), print output with print(), and handle the string-to-number conversion that trips up most beginners.
  3. 03Variables and TypesAssign a name and ask Python what it is. See the types Python tracks for you and why the same value behaves differently depending on what it is.
  4. 04Type ConversionConvert between strings, integers and floats with int(), float() and str(), and see the errors Python raises when a conversion is impossible.
  5. 05Numbers and OperatorsRun arithmetic live in the browser: the difference between / and //, what modulo returns, and how Python rounds when you mix ints and floats.
  6. 06Strings and SlicingStrings are sequences. Index into them, slice them with start:stop:step, and use the methods that make text manipulation read like English.
  7. 07String MethodsSplit, join, strip and test strings with Python's built-in methods, and see how each one returns a new string instead of changing the original.
  8. 08Slicing with StepSlice sequences with start, stop and step, reverse them with [::-1], and see how negative indices count from the end.
  9. 09f-strings and FormattingPlace expressions inside f-strings, apply format specs for alignment and precision, and see how Python turns values into readable text.
  10. 10Lists and IndexingBuild a list, reach into it by index, and see why Python counts positions from zero.
  11. 11Mutability and AliasingSee why assigning a list to a second name does not copy it, and how mutability makes two variables change the same object at once.
  12. 12Shallow vs Deep CopyingCopy a list with slicing or copy(), see that the inner objects stay shared, and use deepcopy when you need a fully independent clone.
  13. 13sorted() with key=Sort any iterable with sorted(), pass a key function to control the comparison, and see how reverse and stable ordering interact.
  14. 14DictionariesStore values under names instead of positions, look them up by key, and handle the key that is not there.
  15. 15Dictionary MethodsUse get, setdefault, update and items to handle dictionaries without the repeated key checks most people write by hand.
  16. 16Nested Data StructuresWork with lists of dictionaries, nested records and mixed structures, and write the loops and lookups that reach any value inside them.
  17. 17Tuples and UnpackingCreate tuples, unpack them into separate variables, and learn where an immutable sequence fits better than a list.
  18. 18Sets and Set OperationsCreate sets, remove duplicates, and use union, intersection and difference to compare collections without writing nested loops.
  19. 19Booleans and ComparisonsCompare values, combine them with and, or and not, and see which everyday values Python already treats as false.
  20. 20None and TruthinessLearn which values Python treats as false in a condition, how None differs from zero and empty, and why is None beats == None.
  21. 21If, Elif and ElseBranch on a condition, and watch indentation decide which lines belong to which branch.
  22. 22Nested ConditionalsRead and write nested if statements, then refactor the ones that grew too deep into flat guard clauses that are easier to follow.
  23. 23Conditional ExpressionsWrite a conditional expression that picks one of two values in a single line and see where it fits better than a full if/else block.
  24. 24match and caseUse match/case to test a value against patterns instead of chains of if/elif, and see how destructuring pulls values out of the match.
  25. 25try and exceptCatch specific exceptions with try/except, handle them without crashing, and see why bare except clauses hide the bugs you need to find.
  26. 26For Loops and range()Loop over a list, count with range(), and accumulate a result across the passes of a for loop.
  27. 27Nested For LoopsRun a loop inside a loop, trace the execution order step by step, and learn when a product of two ranges is the right structure.
  28. 28for/else and while/elseAttach an else clause to a for or while loop so a block of code runs only when the loop finishes without hitting break.
  29. 29range() with stepGenerate number sequences with range using start, stop and step, and see why range produces values lazily instead of building a list.
  30. 30enumerate()Loop through a sequence with enumerate to get the index and item together, and stop tracking positions with a counter variable.
  31. 31zip()Pair items from two or more sequences with zip, iterate them in lockstep, and see what happens when the sequences have different lengths.
  32. 32List ComprehensionsBuild a list in one expression using a comprehension, and compare it with the loop-and-append pattern it replaces.
  33. 33Conditional ComprehensionsAdd an if clause to a list comprehension in two positions and see how filtering differs from choosing between two values.
  34. 34Dict and Set ComprehensionsBuild dictionaries and sets with comprehension syntax, and see how the same loop-in-an-expression pattern works beyond lists.
  35. 35While Loops, break and continueLoop while a condition holds, exit early with break, skip a pass with continue, and see what makes a loop run forever.
  36. 36Functions and Return ValuesDefine a function, pass it arguments, and see why printing a result is not the same as returning one.
  37. 37Function ArgumentsPass arguments by position or by name, set defaults, and see how Python matches each call to the parameters a function expects.
  38. 38*args and **kwargsCollect any number of positional arguments with *args and keyword arguments with **kwargs, and see how both work inside a function.
  39. 39lambda, map and filterWrite small throwaway functions with lambda, apply them across sequences with map and filter, and see where a comprehension is clearer.
  40. 40Variable ScopeTrace how Python resolves a name through local, enclosing, global and built-in scopes, and see why assigning inside a function creates a new local.
  41. 41Reading Errors and TracebacksRead a traceback from the bottom up, recognise the common Python error types, and turn each message into the fix it points at.
  42. 42Files and withOpen, read and write files using the with statement so Python closes them even when your code raises an exception.
  43. 43Modules and importImport a module, understand what Python runs when you do, and organise your own code into files that other scripts can reuse.
  44. 44Generators and yieldWrite a generator that yields values one at a time instead of building a full list, and see how pausing a function saves memory.
  45. 45Classes and ObjectsBuild a class that bundles data with methods, create instances from it, and see how self connects each object to its own attributes.
  46. 46InheritanceBuild a child class that inherits methods and attributes from a parent, override what differs, and call super() to extend behaviour.

Other tracks