Skip to main content

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

Release files for spcalc 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spcalc 2.0.0
File Size Uploaded
spcalc-2.0.0.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spcalc 2.0.0
File Interpreter ABI Platform
spcalc-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.7 kB

Release files / spcalc-2.0.0.tar.gz

Download URL spcalc-2.0.0.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
40f07ce109ae3fe79fc7b5cdecab5e9eceb0a9fd585f2b39775eb08a6581ae65
BLAKE2b-256 checksum
How to use checksums
0cf3374119c6903c8437f9d1ca58abef81f1a43984605df05e676d2a208f9a0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / spcalc-2.0.0-py3-none-any.whl

Download URL spcalc-2.0.0-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a3b2e1273a8fcc91d30826e7f88c6ba3db9a46baf723fcd7c32e3fe9051aae9
BLAKE2b-256 checksum
How to use checksums
ab62f2d3243015f808bacbe7c5d2f16a3711d3238c17b44eefa8609e3c655ca6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.2.0

2 release files

1.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page