Skip to main content

A simple calculator package for basic arithmetic operations

Project description

Calculator project | Module 1 Sprint 2

A simple Python package for performing basic arithmetic operations:

-Addition
-Subtraction
- Multiplication
- Division
-Finding the nth root

Installation

You can install this package directly from PyPI using pip:

pip install calculator_turing_IS

Usage

Calculator class has methods like below:

  • add(number) Adds the given number to the stored result.

  • sub(number) Subtracts the given number from the stored result.

  • mul(number) - Multiplies the stored result by the given number.

  • div(number) - Divides the stored result by the given number. (Cannot divide by zero)

  • root(number) Computes the nth root of the result. (Cannot be zero or an even root of a negative number)

  • reset() Resets the result to 0.

-if you print object then you will see output of the last result

Example of using after installation:

from calculator.calculator import Calculator

calc = Calculator()

print(calc.add(10))  # Output: 10
print(calc.sub(2))   # Output: 8
print(calc.mul(3))   # Output: 24
print(calc.div(3))   # Output: 8
print(calc.root(3))  # Output: "2"
print(calc) # Output: "2"
calc.reset()
print(calc) # Output: "0"

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

calculator_turing_is-1.1.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

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

calculator_turing_is-1.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file calculator_turing_is-1.1.0.tar.gz.

File metadata

  • Download URL: calculator_turing_is-1.1.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.3 Windows/10

File hashes

Hashes for calculator_turing_is-1.1.0.tar.gz
Algorithm Hash digest
SHA256 7d2ffddfaa697fd4e8bd96fa647310fcaa138181b68e2f644b5ee71ba2844242
MD5 cb91cf0a7fede42c07dfabece7152c25
BLAKE2b-256 6f29788f0348269e7a556119c81bb7a465e569f99aa7c17d46bc12e095a3184c

See more details on using hashes here.

File details

Details for the file calculator_turing_is-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for calculator_turing_is-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c53397ec8aeb65aac88edc14ee2b90355c32c6ac1d1b881a81208f0d1579a64d
MD5 18cd0ebac0a9d40f65b5918dee671cbf
BLAKE2b-256 ee7c92c785f7d2d98060da4709dcb532ff9deaba30977fe09e9b6f3775e03693

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