Skip to main content

Command Line Calculator

Project description

Python application test with Github Actions

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

Yasiru Rangana

Version History

License

This project is licensed under the MIT License - see the License file for details

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

spcalc-1.1.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

spcalc-1.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

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

Hashes for spcalc-1.1.0.tar.gz
Algorithm Hash digest
SHA256 1b3375bf9ab215223c169caa84519b72f6ac9d44f3fc1c16e243fe60ba932462
MD5 2c621d133cabc9c7a15d94f1a5ee4c48
BLAKE2b-256 7431aa89d31bf8d8dcb557ff3cefe86a3d749b9f8e09dba8aa3134d5a9ea62ff

See more details on using hashes here.

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

Hashes for spcalc-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5e42990f0ae5db756b486eae0c0f5661185a1f18a535a70e9d81040d245290fe
MD5 bdf261098c88291ea6460fec5c869e27
BLAKE2b-256 7cbaeaeb49a340a0db655139356a8753c3e41de7610a76ec9545445b9ae4debd

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