Set of solutions for 46 Simple python exercises, a list of exercises to introduce people to the Python programming language.
This list of exercises comprises logical operators, loops, input and output, regular expressions and more in order for people to have a basic overview of the language.
In order for better categorization, the exercises have been divided into 4 sections.
- Very Simple Exercises
- Higher Order Functions and List Comprehension
- Simple exercises including Input and Output
- Somewhat harder exercises
To execute a function from the set, just clone the repository or download the .zip containing all the files, then change directory into python-exercises/sections
, open the python command line and import the module in
which the exercise you want to run is in and then call it.
$ git clone https://github.com/sevo/flp_python_exercises.git
$ cd python-exercises/sections
$ python
Python 2.7 (r27:82525, Jul ......
>>> import module_1
>>> module_1.historygram( [ 1, 2, 3 ] )
*
**
***
There is also a test suite for this exercises, the purpose of it is first, so that users can refactor things without breaking something, and second, for having a basic reference on how to test functions and use the basic unittests methods.
$ cd python-exercises
$ python tests.py
.........................................
----------------------------------------------------------------------
Ran 41 tests in 0.218s
OK
Everyone is welcome to contribute. Feel free to submit a pull request, issue or suggestion you may find relevant.
The original collection of exercises was created by Torbjörn Lager (torbjorn.lager@ling.gu.se) and can be found here.