Skip to main content

A simple command-line calculator program that can perform basic arithmetic operations and nth root calculation.

Project description

SimpleCalculator

A simple command-line calculator program that can perform basic arithmetic operations and nth root calculation.

Features

  • Add, subtract, multiply, and divide numbers
  • Calculate the nth root of a number
  • Reset the calculator value to zero
  • Validation for input numbers

Installation

pip install simplecalculator-turing==0.0.6

Usage

  1. Run the program by running simplecalculator in your terminal
  2. Follow the prompts to enter operations and numbers
  3. Type 'exit' to quit the program

Code Structure

  • init: Initialize the calculator with an initial value of 0
  • add: Add a number to the current value
  • subtract: Subtract a number from the current value
  • multiply: Multiply the current value by a number
  • divide: Divide the current value by a number
  • nth_root: Calculate the nth root of the current value
  • reset: Reset the current value to 0
  • _validate_number: Validate if the given value is a number (float or int)
  • run: Run the calculator program until the user types 'exit'

License

This program is distributed under the terms of the GNU General Public License v3.0. For more details, visit https://www.gnu.org/licenses/gpl-3.0.en.html#license-text

Examples

To start the program type the below code in your command prompt or terminal.
simplecalculator

You will receive the following prompt to select from one of the following commands:
Enter an operation to perform ('add', 'subtract', 'multiply', 'divide', 'nth_root', 'reset', or 'exit'):

  1. Type in one of the arithmetic operations: add
  2. Select a number: Enter a number: 8
  3. Receive the current value: The current value is: 8.0
  4. Type in one of the arithmetic operations: subtract
  5. Select a number: Enter a number: 4
  6. Receive the current value: The current value is: 4.0

If you would like to reset the calculator to 0. Type in reset. The calculator has been reset to 0.

If you would like to quit the calculator. Type in exit.

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

simplecalculator_turing-0.0.6.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

simplecalculator_turing-0.0.6-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file simplecalculator_turing-0.0.6.tar.gz.

File metadata

  • Download URL: simplecalculator_turing-0.0.6.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for simplecalculator_turing-0.0.6.tar.gz
Algorithm Hash digest
SHA256 f01c2a71d0c1eea42e4542fa8625c07a4ced5da70eff4eb6da15f81b031a22d4
MD5 259af1536121980969e07e025443c47a
BLAKE2b-256 1e640af8749288d864603bb8c5645cb2f1925a1ee6d63d5399462b40e7ce1de0

See more details on using hashes here.

File details

Details for the file simplecalculator_turing-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for simplecalculator_turing-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 1fe07545363437fb19241d1238feca4613cc6eeb3300341146e2277c726513fb
MD5 942db91e889b348d15b6f823b4eddaf8
BLAKE2b-256 32fb64023b9139dd517e5752783a7911b8c2cc78d2707a4613ec0100ea731ed8

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