commit 31f4fa6c319b7dd58bd8debaaa16f02cbc55185f Author: venomade Date: Mon Oct 19 10:07:34 2026 +0100 Add addition and subtraction functions diff --git a/README.md b/README.md new file mode 100644 index 0000000..691d2f1 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# Calculator +A simple calculator application for the Terminal, built step by step in SCCM4910. +It will run on `Python 3` via the `calculator.py` script. + +## What It Will Do +Add, subtract, multiply and divide two numbers; display the result. + +## How to Run It +From Week 3: `python3 calculator.py` + +## Usage +- First enter a number +- Then enter an operator (`+`,`-`,`*` or `/`) +- Lastly enter a second number +- Read the result, printed as `Result: ` followed by the answer. diff --git a/REQUIREMENTS.md b/REQUIREMENTS.md new file mode 100644 index 0000000..1124aee --- /dev/null +++ b/REQUIREMENTS.md @@ -0,0 +1,12 @@ +# Requirements +1. Addition +2. Subtraction +3. Multiplication +4. Division +5. Displaying a result +6. Run in a standard terminal + +Examples: +Input: `12 / 0` +Output: `Runtime error: Divide by zero` + diff --git a/calculator.py b/calculator.py new file mode 100644 index 0000000..e1732c1 --- /dev/null +++ b/calculator.py @@ -0,0 +1,5 @@ +def add(a, b): + return a + b + +def subtract(a , b): + return a - b