Skip to main content

This is my first experience creating a simple python calculator module.

Project description

Calculator

This calculator package can perform addition, subtraction, multiplication, and division, as well as taking a (n) root of a number and also resetting its memory.

For each operation, it takes only one input number and combines it with the current value in its own memory, which can be reset to zero.

The technology stack for this project includes Python for building the package, Docker for containerizing the package, and Pytest for testing the package.


Features

  • Addition: The input value is added to the memory value.
  • Subtraction: The input value is subtracted from the memory value.
  • Multiplication: The input value is multiplied by the memory value.
  • Division: The input value is divided by the memory value.
  • Root: The input value root of the memory value is returned.
  • Reset: The memory value is reset to zero.

Installation

You can run any of the commands below to install the package.

To install the package from PyPI

$ pip install calculatorvadim

To install from github

$ pip install git+https://github.com/vadimiljin/calculatorvadim.git

To get the calculator image from docker hub

$ docker pull iljinvadim/calculatorvadim

Usage

Usage examples for each method are given below.

>>> from calculatorvadim import Calculator
>>> calculator = Calculator()
>>> calculator.add(4)
4
>>> calculator.subtract(2)
2
>>> calculator.multiply(12)
24
>>> calculator.divide(3)
8.0
>>> calculator.root(3)
2.0
>>> calculator.reset()
0

Testing

$ pytest

License

This project is licensed under the terms of the MIT license


Author

Vadim Iljin

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

calculatorvadim-0.0.4.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

calculatorvadim-0.0.4-py2.py3-none-any.whl (3.4 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page