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.1.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.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: calculator_turing_is-1.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 44e814a8d8914e652fb8dc124a6bd4c4a71cfd4550cd16eef45544f6755c4ad7
MD5 776fce539aca43e9f177c87ab010c438
BLAKE2b-256 76013e9c2b88e50d3106c0f7f01fc860d81c3bacc22282b91ca7287e8c812364

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for calculator_turing_is-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 70e40d5fcde0f5ca365007964bcfe7f946dcf907e4c9ccb357b48acf5337bdad
MD5 5d2ebc425f50f07e3f39613a6adfc80d
BLAKE2b-256 5d2be8ec94059b8712ccd32a08abd397cc378c8bd25a2f03a93ce272edf14958

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