Learn-Python

github.com/trekhleb/learn-python Learn to Code Open-source projectOpen source

A Python learning playground and cheat sheet organizes example scripts by topic, with explanations for the code.

github.com/trekhleb/learn-python
Learn-Python homepage screenshot

About Learn-Python

Learn-Python is a GitHub repository that collects Python scripts organized by topic, such as data types, control flow, functions, classes, modules, errors and exceptions, and file handling. Each script includes a docstring with the topic name, a link to further reading, and explanations of the code examples.

The repository can be used as both a practice playground and a cheat sheet. Learners can change the code, add assertions, and run tests and linting to check their work against the Python style guide. The examples include assertions that show expected output, so the results can be seen without running the code. Running the tests and linting requires a local Python setup, as the repository describes these as steps the user performs. The repository is open source and includes a LICENSE file. Pricing is unknown.

Key features

  • Python scripts grouped by topic, from basic syntax to files and exceptions
  • Code examples with explanations and links to further reading in each script's docstring
  • Assertions that show expected output for each example without running the code
  • Editable examples that can be changed or extended and tested with assertions
  • Linting setup with .flake8 and pylintrc files to check Python code style
  • README files available in Spanish, Portuguese, Traditional Chinese, and Ukrainian
Best for: Beginners who want to learn Python syntax by reading, editing, and testing examples, and experienced learners who want a reference to review standard Python statements.
Good for
  • Open source, with a LICENSE file in the repository
  • Each topic script links to further reading and includes explanations of the code
  • Assertions show expected results directly next to each example
Watch out for
  • Running tests and linting requires working with the code locally
  • The described topics cover core Python statements and constructions; the source does not describe other subject areas

Learn-Python at a glance

Type
Open-source project
Pricing
Not confirmed. Check the site
Open source
Yes · Source code
Language
English
Last checked
Oct 6, 2026 · Online when checked
Listed
Oct 5, 2026

Learn-Python alternatives

Tools and sites you could use instead, ranked by how closely they match.

All 24 alternatives

Popular in Learn to Code

Well-known listings from the same topic.

All 387

Learn-Python FAQ

Is Learn-Python open source?
Yes. The repository is listed as open source and includes a LICENSE file.
How can I check whether my changes follow Python style rules?
The repository says you can lint the code to check whether it fits the Python code style guide. It includes .flake8 and pylintrc configuration files.
Is something wrong or out of date?

Tell us and an editor will check it.

Own this website?

Claim the listing and suggest updates yourself. An editor checks every claim first.

Claim this listing