Skip to main content

Simple calculator, performing basic functions

Project description

Hello!

For the Module 1 Sprint 1 project I was supposed to create a Python package that is capable of conducting basic calculator-like functions, including:
  • Addition/ Subtraction;
  • Multiplication/ Division;
  • Taking (n) root of a number;
  • Resetting memory.

    IMPORTANT note! Calculator is capable of accepting both integers and float numbers.

    How to use it?

    1. First of all, let's install the package. It can be accessed both - in your local machine and remote (like Google Colab)

    pip install TACalculator-v3
    

    2. Import module "Calculator" from a package

    from file.calculator import Calculator
    

    3. Create an instance of the Calculator class:

    calculator = Calculator()
    

    *IMPORTANT note: By default calculator's memory is set to 0.0

    Known biases, possible areas for improvement:

    1. Error handling and input validation. It is expected that user will by himself handle possible Errors i. e. (division by Zero, math with string values, etc.)
    2. Additional functionality. Calculator can easily have more algebra functions.

    Main functions

    Addition

    To add a value to the memory value, use the add(value) method. This will add 12.0 to the memory value and will return the new value.

    calculator.add(12.0)
    

    Substraction

    To subtract a value from the memory value, use the subtract(value) method. This will subtract 5.0 from the memory value and will return the new value.

    calculator.subtract(5.0)
    

    Multiplication

    To multiply the memory value by a value, use the multiply(value) method. This will multiply the memory value by 6.0 and will return the new value.

    calculator.multiply(6.0)
    

    Division

    To divide the memory value by a value, use the divide(value) method. This will divide the memory value by 2.0 and will return the new value.

    calculator.divide(2.0)
    

    Root

    To take the 1/nth root of the memory value, use the root(value) method. This will take the third level root of the memory value and will return the new value.

    calculator.root(3)
    

    Reset

    To reset the memory value to 0.0, use the reset() method. This will reset the memory value to 0.0 and will return the 0.0 value.

    calculator.reset()
    

    Thank you for you attention!

    I am open for a feedback!

  • 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

    TACalculator-v4-0.2.tar.gz (6.9 kB view details)

    Uploaded Source

    Built Distribution

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

    TACalculator_v4-0.2-py3-none-any.whl (7.6 kB view details)

    Uploaded Python 3

    File details

    Details for the file TACalculator-v4-0.2.tar.gz.

    File metadata

    • Download URL: TACalculator-v4-0.2.tar.gz
    • Upload date:
    • Size: 6.9 kB
    • Tags: Source
    • Uploaded using Trusted Publishing? No
    • Uploaded via: twine/4.0.2 CPython/3.9.12

    File hashes

    Hashes for TACalculator-v4-0.2.tar.gz
    Algorithm Hash digest
    SHA256 ed2e32833d7bb0d7ef28af628c85811067c04825ee695d46271ce669d6242af2
    MD5 39525efec23a2778a777ed2cccae1d4d
    BLAKE2b-256 2c645d8dbc600eda5db8536ff7317ff090cd244eeda033e32b0dd34dee362544

    See more details on using hashes here.

    File details

    Details for the file TACalculator_v4-0.2-py3-none-any.whl.

    File metadata

    • Download URL: TACalculator_v4-0.2-py3-none-any.whl
    • Upload date:
    • Size: 7.6 kB
    • Tags: Python 3
    • Uploaded using Trusted Publishing? No
    • Uploaded via: twine/4.0.2 CPython/3.9.12

    File hashes

    Hashes for TACalculator_v4-0.2-py3-none-any.whl
    Algorithm Hash digest
    SHA256 1114c999c13e2de9aefd479d7b15ac4ca4430d665c13a49bdac9c118a885f938
    MD5 c20ea429bcb5df28e9dd919215f2aeae
    BLAKE2b-256 ede146313987a6465d5e035dad3bf451532e4ad91ef116af3cdb106a68f975d4

    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