Python: from first line to expert

The friendliest first language. Print, decide, repeat, and build up to classes, generators and decorators, all in your browser.

Beginner to expert · 14 lessons · about 127 minutes

Start the track
  1. Your first program BeginnerMake Python print a message, and see your first output.5 min
  2. Variables and types BeginnerStore values under names, and learn the difference between text and numbers.6 min
  3. Numbers and f-strings BeginnerDo arithmetic and format results neatly with f-strings.7 min
  4. Input and decisions BeginnerAsk the user a question and react to the answer with if, elif and else.8 min
  5. Loops BeginnerRepeat work with for and range, and keep going with while.8 min
  6. Functions BeginnerName a piece of work with def, pass it values, and return a result.8 min
  7. Lists BeginnerKeep many values in order, loop over them, and sort, slice and change them.9 min
  8. Dictionaries IntermediateLook values up by name with dictionaries, and count things with them.9 min
  9. Working with text IntermediateClean, search, split and reshape strings with Python's string methods.9 min
  10. Comprehensions IntermediateBuild lists and dictionaries in one readable line.9 min
  11. Exceptions IntermediateHandle errors with try and except, and raise your own when input is wrong.10 min
  12. Classes AdvancedModel things in your program with classes, methods and inheritance.12 min
  13. Iterators and generators AdvancedProduce values one at a time with yield, and handle sequences too big to keep in memory.12 min
  14. Decorators and memoization ExpertWrap functions to add behaviour, and make slow recursive code fast.15 min
Track project · Reviewed by a mentor · PremiumProject: School grade reportTurn a class's marks into grades, report cards, subject averages and a ranked class list.