All paths
PythonBeginner

Python Basics

First steps with Python

21 chapters87 lessons245 challenges

Course curriculum

Chapter 1: Variables, Types & Operators

  • Variables and types
  • Arithmetic operators
  • Comparisons and truthiness

Chapter 2: Data Structures: list, tuple, dict, set

  • Lists
  • Tuples
  • Dictionaries
  • Sets

Chapter 3: Control Flow & Comprehensions

  • if / elif / else
  • The for loop
  • The while loop
  • List comprehensions

Chapter 4: Strings and formatting

  • Strings
  • String methods
  • f-strings and formatting
  • Slicing

Chapter 5: Functions

  • Defining a function
  • Parameters and arguments
  • Default values and keyword arguments
  • return vs print

Chapter 6: Errors and exceptions

  • Exceptions
  • try / except
  • Handling specific exceptions
  • finally and raise

Chapter 7: Modules and imports

  • Importing a module
  • from ... import
  • Aliases with as
  • The standard library

Chapter 8: OOP: classes and objects

  • Classes and objects
  • Attributes and __init__
  • Methods
  • Inheritance

Chapter 9: Advanced comprehensions

  • Dict comprehension
  • Set comprehension
  • Comprehensions with a condition
  • Nested comprehensions

Chapter 10: Generators

  • yield: the generator function
  • Consuming a generator
  • Generator expressions
  • Why generators

Chapter 11: Decorators

  • Functions are objects
  • What is a decorator
  • The @ syntax
  • Decorators with arguments

Chapter 12: Lambda and higher-order functions

  • Lambda
  • map and filter
  • sorted with key
  • Higher-order functions

Chapter 13: Interview topics

  • is vs ==
  • Mutable default arguments
  • Copy vs reference
  • args and kwargs

Chapter 14: Type hints and typing

  • Type annotations
  • Optional and Union
  • Typed collections
  • dataclasses
  • NamedTuple and TypedDict

Chapter 15: The data model: dunder methods

  • The data model and dunder methods
  • __str__ and __repr__
  • __eq__ and __hash__
  • Behaving like a sequence
  • Operator overloading
  • __call__ and other dunders

Chapter 16: Context managers (with)

  • The with block
  • __enter__ and __exit__
  • contextlib.contextmanager
  • Exceptions and cleanup
  • contextlib tools

Chapter 17: Advanced decorators

  • Decorators and functools.wraps
  • Decorators with arguments
  • property
  • lru_cache and functools
  • Stateful and class decorators

Chapter 18: Advanced iterators and itertools

  • The iterator protocol
  • yield from
  • Generator pipelines
  • itertools: the essentials
  • itertools: accumulate and groupby

Chapter 19: collections and heapq

  • Counter
  • defaultdict
  • deque
  • namedtuple
  • heapq: priority queues

Chapter 20: Performance and best practices

  • Comprehensions vs loops
  • Generators for memory
  • The right structures
  • Pythonic idioms
  • Common pitfalls

Chapter 21: Final project: Contact book

Ready to level up?

Create a free account and start now: earn XP on every challenge and climb the leaderboard.

Python Basics — LevelUpCode