Skip to main content
eLearner.app

End of the Python Course

Summary and final challenge

Congratulations: you have made it through the 9 modules of the Python Course — from your very first variables and if statements to @dataclass, contextmanager, and @decorator. Below is a map of everything you have mastered and a three-step final challenge.

01 · Basics

  • variables
  • types
  • f-strings
  • input/output

02 · Control flow

  • if / elif
  • for / while
  • break / continue
  • try / except

03 · Data structures

  • lists
  • tuples
  • sets
  • dicts

04 · Strings and numbers

  • string methods
  • slicing
  • math
  • formatting

05 · Functions

  • def / return
  • *args / **kwargs
  • lambda
  • scopes

06 · Comprehensions and iterators

  • list/dict/set comp
  • generators
  • map / filter
  • itertools

07 · OOP and modules

  • classes
  • __init__
  • inheritance
  • imports

08 · Standard library

  • json
  • datetime
  • collections
  • re

09 · Modern Python

  • type hints
  • dataclasses
  • context managers
  • decorators

The final challenge, in three steps

Imagine a small utility that parses text logs, aggregates counts, and handles errors robustly. Build the three parts: the parser, the aggregator, and the retry decorator. Each step combines concepts from the modules you have studied — no new lessons.

1 · Extract words from a string

Write parole(testo): returns a list of all words in lowercase (sequences of alphanumeric characters). Module 8 (re) + Module 4 (string methods).

Exercise#python.boss.e1
Attempts: 0Loading…

Define parole(testo: str) -> list[str] which returns all the "words" of the text (re.findall of \w+) all in lowercase. Example: parole("Ciao Mondo, ciao!") -> ["ciao", "mondo", "ciao"].

Loading editor…
Show hint

re.findall(r"\w+", testo) and list comprehension with .lower().

Solution available after 3 attempts

2 · Top-N words with Counter

Count how many times each word appears and return the top N most frequent ones. Module 8 (collections) + Module 6 (iterators).

Exercise#python.boss.e2
Attempts: 0Loading…

Define top_parole(testo: str, n: int) -> list[tuple[str, int]] which uses parole() (reusing the function from step 1) and Counter to return the n most frequent words, sorted from most common down.

Loading editor…
Show hint

Counter(parole(testo)).most_common(n) does all the work.

Solution available after 3 attempts

3 · Retry decorator @retry

Write a decorator that retries a function up to N times if it raises an exception. Module 9 (decorators) + Module 2 (try/except).

Exercise#python.boss.e3
Attempts: 0Loading…

Define retry(tentativi: int) as a parameterized decorator. The decorated function is called up to "tentativi" times: if it raises an exception, it retries; if all attempts fail, let the last exception propagate. Use functools.wraps.

Loading editor…
Show hint

retry(n) returns a decorator. The decorator returns a wrapper. The wrapper loops n times: try calls the function, except stores the exception and continues. If the loop completes without success, raise the stored exception.

Solution available after 3 attempts

Printable Cheatsheet

A single page with all the essential syntax of modern Python, ready to keep handy while you code.

Open the cheatsheet

What now?

The best way to solidify your knowledge is free practice. Open an editor (or the Python Playground) and try to rewrite the most complex exercises from memory, or build small scripts: a log analyzer, a JSON data scraper, a small CLI tool using argparse.