Skip to content

python-beginner-help/python-beginner-exercises

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Beginner Help

Python Beginner Exercises 🏋️🐍

Small, runnable practice exercises for new Python programmers — each with a built-in self-check and a worked solution.

These exercises mirror the learning track on pythonbeginner.help. Read a topic, then practice it here.

How to use

  1. Make sure you have Python installed (3.8+).

  2. Open an exercise in the exercises/ folder and complete the TODOs.

  3. Run it — each file checks your answer with assert and prints ✅ when it passes:

    python exercises/01_variables.py
  4. Stuck? Compare with the matching file in solutions/.

  5. Run every exercise at once with the bundled runner:

    python run_all.py            # stop on first failure
    python run_all.py --keep     # run them all, report each result

The runner also reports any unfinished exercise (one that still contains ... TODO placeholders) as SKIP so you can see at a glance what's left to do.

Exercises

# Exercise Topic Tutorial
01 Variables & types Variables, int / str Learn →
02 String methods Strings, slicing Learn →
03 Lists Lists, indexing, sorted() Learn →
04 Loops for and range Learn →
05 Functions def, return values Learn →
06 Dictionaries dict, .get(), keys Learn →
07 Conditionals if / elif / else, ternary Learn →
08 Files open, read, write Learn →
09 Errors & try/except try, except ValueError Learn →
10 Classes class, __init__, methods Learn →

CI

Every push and pull request runs all of the solutions/*.py files through GitHub Actions on Python 3.11, so the answers are always verified to work. See .github/workflows/exercises.yml.

Run all exercises at once

for f in exercises/*.py; do echo "== $f =="; python "$f"; done

…or just use the runner above.

Companion repos

License

Released under CC0 1.0 by pythonbeginner.help — copy, remix, and teach with these freely.

About

Runnable beginner Python exercises with self-checks and solutions. Powered by pythonbeginner.help

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages