Skip to content

About

26 auto-graded Python exercises to practice writing functions that compute with numbers: arithmetic operators, integer division, modulo, the math module, conditionals and simple loops.

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

🐍 Master Python: Functions and Numbers at 4Geeks Academy

By @alesanchezr and other contributors at 4Geeks Academy

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

26 auto-graded Python exercises

Practice writing small functions that receive values, compute with numbers and return a result. You will use arithmetic operators (+ - * / ** // %), the math module, rounding, conditionals and simple loops to solve everyday problems.

🗺️ 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 (📍 you are here) functions, arithmetic operators, the math module, conditionals and simple loops
5 Master Python: Strings and Collections strings, lists, tuples, dictionaries, sets, comprehensions and sorting
6 Master Python: Classes and OOP classes, special methods, inheritance, properties, composition, dataclasses and iterators

⬅️ Previous: Python Lists and Loops

➡️ Next: Master Python: Strings and Collections

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-functions-exercises.git
cd master-python-functions-exercises
learnpack start

What will you practice?

  • Exercises: 001-026
  • Focus: defining functions, parameters, return (including several values), arithmetic operators, integer division and modulo, the math module, rounding, conditionals and simple loops
  • Difficulty: beginner

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

26 auto-graded Python exercises to practice writing functions that compute with numbers: arithmetic operators, integer division, modulo, the math module, conditionals and simple loops.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages