Skip to main content

Stratergy Pattern 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-2.0.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

spcalc-2.0.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file spcalc-2.0.0.tar.gz.

File metadata

  • Download URL: spcalc-2.0.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for spcalc-2.0.0.tar.gz
Algorithm Hash digest
SHA256 40f07ce109ae3fe79fc7b5cdecab5e9eceb0a9fd585f2b39775eb08a6581ae65
MD5 8ffc709cf4f31099387fc17c07be22af
BLAKE2b-256 0cf3374119c6903c8437f9d1ca58abef81f1a43984605df05e676d2a208f9a0c

See more details on using hashes here.

File details

Details for the file spcalc-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: spcalc-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for spcalc-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a3b2e1273a8fcc91d30826e7f88c6ba3db9a46baf723fcd7c32e3fe9051aae9
MD5 3b2b5f162f5069a4e4b5a547c4be928b
BLAKE2b-256 ab62f2d3243015f808bacbe7c5d2f16a3711d3238c17b44eefa8609e3c655ca6

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