Skip to content

About

20 auto-graded Python exercises to practice working with text and data collections: string methods, lists, tuples, dictionaries, sets, comprehensions, parsing and sorting.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

🐍 Master Python: Strings and Collections at 4Geeks Academy

By @alesanchezr and other contributors at 4Geeks Academy

Estas instrucciones también están disponibles en Español 🇪🇸

20 auto-graded Python exercises

Practice transforming text and data: split and join strings, count characters, remove duplicates with sets, build dictionaries, use list comprehensions, parse simple formats and sort records by several criteria.

🗺️ Python practice path

This LearnPack is part of a series. We recommend completing them in order:

# LearnPack What you practice
1 Python for Beginners print, variables, input and basic operations
2 Python Functions defining and calling functions, parameters and return
3 Python Lists and Loops lists, for/while loops and iteration patterns
4 Master Python: Functions and Numbers functions, arithmetic operators, the math module, conditionals and simple loops
5 Master Python: Strings and Collections (📍 you are here) strings, lists, tuples, dictionaries, sets, comprehensions and sorting
6 Master Python: Classes and OOP classes, special methods, inheritance, properties, composition, dataclasses and iterators

⬅️ Previous: Master Python: Functions and Numbers

➡️ Next: Master Python: Classes and OOP

One-click installation (recommended)

Open in Codespaces.

Once VS Code is open, LearnPack should start automatically. If it doesn't, run learnpack start in the terminal.

Local installation

  1. Make sure you have Node.js 18+ and Python 3.10+ installed.

  2. Install LearnPack, the Python plugin and the testing tools:

npm i @learnpack/learnpack -g && learnpack plugins:install @learnpack/python
pip3 install pytest==6.2.5 pytest-testdox mock
  1. Clone this repository and start the exercises:
git clone https://github.com/4GeeksAcademy/master-python-collections-exercises.git
cd master-python-collections-exercises
learnpack start

What will you practice?

  • Exercises: 001-020
  • Focus: string methods, split() / join(), lists, tuples, dictionaries, sets, *args, list comprehensions, nested lists, parsing text and sorting with sorted() and key
  • Difficulty: beginner to intermediate

How are the exercises organized?

Each exercise folder contains:

  1. README.md / README.es.md: the instructions (English / Spanish).
  2. app.py: the starter file where you write your solution.
  3. test.py: the automatic grading tests. You don't need to open it, but you can read it if you are stuck.

Click Run to execute your app.py and Test to grade it.

Contributors

These exercises were originally part of Master Python. Thanks to Alejandro Sánchez (alesanchezr), Paolo (plucodev), Marco Gómez (marcogonzalo) and every contributor. Found a typo or a bug? Open an issue.

About

20 auto-graded Python exercises to practice working with text and data collections: string methods, lists, tuples, dictionaries, sets, comprehensions, parsing and sorting.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages