Command Line Calculator
Project description
Strategy Pattern Calculator
Python implementation of a command line calculator using the strategy design pattern
Description
This is a simple command-line calculator that can perform basic arithmetic operations. The calculator is implemented using the strategy design pattern. The calculator can perform the following operations:
- Addition
- Subtraction
- Multiplication
- Division
To be implemented:
- Setup tool to install the calculator as a package
- Exponentiation
- Square root
- Logarithm
Getting Started
Installing
- Clone the repository
git clone https://github.com/yrangana/Strategy_Pattern_Calculator.git
- Install the dependencies
make install
Executing program in python
- Run the calculator with prompts
python src/main.py
- Run the calculator with arguments
python src/main.py -n1 <first number> -n2 <second number> -op <operation>
- Run the tests
make test
Executing program in CLI
- Setup as a Command Line Tool
python -m pip install --editable .
- Run the calculator with prompts
spcalc
- Run the calculator with arguments
spcalc -n1 <first number> -n2 <second number> -op <operation>
Help
Usage: main.py [OPTIONS]
Options:
-n1, --num1 FLOAT First number
-n2, --num2 FLOAT Second number
-op, --operation [add|subtract|multiply|divide]
Operation to perform
--help Show this message and exit.
Authors
Version History
- V1.0.0
- V1.1.0
License
This project is licensed under the MIT License - see the License file for details
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 spcalc-1.1.0.tar.gz.
File metadata
- Download URL: spcalc-1.1.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b3375bf9ab215223c169caa84519b72f6ac9d44f3fc1c16e243fe60ba932462
|
|
| MD5 |
2c621d133cabc9c7a15d94f1a5ee4c48
|
|
| BLAKE2b-256 |
7431aa89d31bf8d8dcb557ff3cefe86a3d749b9f8e09dba8aa3134d5a9ea62ff
|
File details
Details for the file spcalc-1.1.0-py3-none-any.whl.
File metadata
- Download URL: spcalc-1.1.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e42990f0ae5db756b486eae0c0f5661185a1f18a535a70e9d81040d245290fe
|
|
| MD5 |
bdf261098c88291ea6460fec5c869e27
|
|
| BLAKE2b-256 |
7cbaeaeb49a340a0db655139356a8753c3e41de7610a76ec9545445b9ae4debd
|