Usage of Internet is authorized.
Install requirements (with pip):
pip install -r requirements.txt
If you want to test your code, put your functions inside fill_me.py files.
This is an example, and a good start.
pytest exercises/function
# or
python -m pytest exercises/function
Note: You will get a lot of errors if not all required functions are implemented.
pytest
# or
python -m pytest
- imports,
- from imports,
- defining functions with builtin names,
- calls of function with builtin names except ['int', 'list', 'dict', 'bool', 'str', 'float', 'tuple', 'type', 'ord', 'chr'],
- calls of methods (eg. 'my_list.append()'),
- try clauses,
- break and continue statements,
- variables with builtin names or trailing underscore (eg. 'my_var_'),
- for loop,
- list comprehensions,
- dict comprehensions,
- set comprehensions,
- generator expressions,
- yield and yield from statements,
- raise statements,
- assert statements,
- while else statements,
- global statements,
- nonlocal statements,
- following operators on list: ['+', '+=', '==', '>=', '<=', '>', '<', '!=', '*='],
- following operators on dict: ['+', '+=', '==', '>=', '<=', '>', '<', '!=', '*=', '|', '&'],
- 3 args form of type,
- class definitions,
- in and not in operator,
- is and is not operator,
- positional only arguments, keyword only arguments, keywords defaults arguments, defaults arguments, variadic arguments, variadic keyword arguments,
- slices,
- packing and unpacking,
PEP 8 is a style guide for Python. You can find it here.
You must respect two other rules:
- Line length must be less than 80 characters,
- Function length must be less than 25 lines.
Since you aren't allowed to use some python features, you should test your
code with custom rules. This project has a setup.cfg
file with
a flake8 configuration, so you can run flake8
to check your
code with properly excluded errors.
flake8
# or
python -m flake8
- If the error is raised by flake8 because you didn't use a forbidden feature, you should report it on the issue tracker.
- If the error raised by flake8 is about complexity, you should reduce the cognitive complexity of your code.
Copyright © 2022 Dorian Turba