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
- Run the program by running
simplecalculatorin your terminal - Follow the prompts to enter operations and numbers
- 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'):
- Type in one of the arithmetic operations:
add - Select a number:
Enter a number: 8 - Receive the current value:
The current value is: 8.0 - Type in one of the arithmetic operations:
subtract - Select a number:
Enter a number: 4 - 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f01c2a71d0c1eea42e4542fa8625c07a4ced5da70eff4eb6da15f81b031a22d4
|
|
| MD5 |
259af1536121980969e07e025443c47a
|
|
| BLAKE2b-256 |
1e640af8749288d864603bb8c5645cb2f1925a1ee6d63d5399462b40e7ce1de0
|
File details
Details for the file simplecalculator_turing-0.0.6-py3-none-any.whl.
File metadata
- Download URL: simplecalculator_turing-0.0.6-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fe07545363437fb19241d1238feca4613cc6eeb3300341146e2277c726513fb
|
|
| MD5 |
942db91e889b348d15b6f823b4eddaf8
|
|
| BLAKE2b-256 |
32fb64023b9139dd517e5752783a7911b8c2cc78d2707a4613ec0100ea731ed8
|