Skip to main content

Calculator module

Project description

Calculator

Does basic math operations

Methods :

  • add - Adds the given number to the current number in the calculator memory
  • subtract - Subtracts the given number from the current number in the calculator memory
  • multiply - Multiplies current number in the calculator memory by the given number
  • divide - Divides current number in the calculator memory by the given number
  • root - Takes the given number root of the current number in the calculator
  • reset - Resets calculator memory, default: 0

Installation

pip install nershcalculator

Usage

Addition of numbers:

>>> from nershcalculator import Calculator
>>> calculations = Calculator()
>>> calculations.add(5)
'5.0'
>>> calculations.add(10)
'15.0'

Subtraction of numbers:

>>> from nershcalculator import Calculator
>>> calculations = Calculator()
>>> calculations.subtract(5)
'-5.0'
>>> calculations.subtract(10)
'-15.0'

Number multiplication:

>>> from nershcalculator import Calculator
>>> calculations = Calculator(5)
>>> calculations.multiply(10)
'50.0'
>>> calculations.multiply(5)
'250.0'

Number division:

>>> from nershcalculator import Calculator
>>> calculations = Calculator(5)
>>> calculations.divide(5)
'1.0'
>>> calculations.divide(5)
'0.2'

Taking n root out of a number:

>>> from nershcalculator import Calculator
>>> calculations = Calculator(125)
>>> calculations.root(3)
'5.0'

Resetting calculator:

>>> from nershcalculator import Calculator
>>> calculations = Calculator()
>>> calculations.add(100)
'100.0'
>>> calculations.reset()
'0.0'

Changelog

License

MIT

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

nershcalculator-0.3.1.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

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

nershcalculator-0.3.1-py2.py3-none-any.whl (2.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file nershcalculator-0.3.1.tar.gz.

File metadata

  • Download URL: nershcalculator-0.3.1.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.25.1

File hashes

Hashes for nershcalculator-0.3.1.tar.gz
Algorithm Hash digest
SHA256 a5f321c365a071f91f54b1258cffd85025734d08f56c1c1d7424894d66d7a2c5
MD5 dfd941e6685633b4fb063dea85ab1511
BLAKE2b-256 fa46bf017c7f52ac88a75b6c69ea7f5aa369e4e2a24c4b3aa5100b178b6bb2a7

See more details on using hashes here.

File details

Details for the file nershcalculator-0.3.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for nershcalculator-0.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a5a64981c732fd8758e8ef537392bfa13be02ac0a23f06684b5cea51e47a6f00
MD5 e9f1b420981d28a1a36d7b52dbbe69a4
BLAKE2b-256 39e584d4d082050e30e79603784fd94a52544efcc654d4b97e4d6d5ae3234634

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