A simple implementation of a binary to decimal converter.
This is and implementation of the Bin2Dec app idea on Florin Pop's App ideas repository.
Following the description in the user histories, which can be found here, this implementation comply to the following constraints:
- User can enter up to 8 binary digits in one input field
- User must be notified if anything other than a 0 or 1 was entered
- User views the results in a single output field containing the decimal (base 10) equivalent of the binary number that was entered
And as an extra increment:
- User can enter a variable number of binary digits
This implementation uses Pipenv as an virtual environment manager. The environment was created from a Python 3.6.0 base interpreter. Pipenv can be installed via pip using:
pip install pipenvThe only other dependency of the project is pytest, used to run the unit tests of the project. Once pipenv is installed, it can initialized and have pytest installed using:
pipenv shell
pip install pytestThe project can be execute as a standard Python script, taking one or more binary strings as command line arguments.
python bin_to_dec.py 000101 11101 111001The line above should output the following
5
29
57