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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 2Python 3

File details

Details for the file calculatorvadim-0.0.4.tar.gz.

File metadata

  • Download URL: calculatorvadim-0.0.4.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.27.1

File hashes

Hashes for calculatorvadim-0.0.4.tar.gz
Algorithm Hash digest
SHA256 3951579d9c16d37134d78d08640e611500a51cfc205963156cfe8a35a1457eee
MD5 5b52bed5127fb323354d244628e23ec6
BLAKE2b-256 e00fb0686c68eba59cc7421063ce1ee28a33eb193f94b981a1331d8c0a61f196

See more details on using hashes here.

File details

Details for the file calculatorvadim-0.0.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for calculatorvadim-0.0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 aff44e8e434fdd8d37ed424d086a5758793f34839cedf673fd16b8e8592843c3
MD5 b7d70f7521027b76a4c11918e8e308ef
BLAKE2b-256 71ba72ca35cac2badcdac9bb641ccc5a39625f24abef78216f2d7560c663ae1c

See more details on using hashes here.

Supported by

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