From d784fb476fb0435db7b07210cdd46a49b86164fe Mon Sep 17 00:00:00 2001 From: AsianRYRY Date: Tue, 17 Feb 2026 18:20:07 -0500 Subject: [PATCH 01/13] Change name Changed the text within name --- labs/lab_1/lab_1a.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labs/lab_1/lab_1a.py b/labs/lab_1/lab_1a.py index 9d15ec83..4119259e 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -8,7 +8,7 @@ def main(): print("Hello World!") - name = "" # TODO: Insert your name between the double quotes + name = "Henry Nguyen" # TODO: Insert your name between the double quotes print(f"{name}, Welcome to the CSS course!") From 2f2ed52d3517a4251972c567e20ca87f2866a9c4 Mon Sep 17 00:00:00 2001 From: AsianRYRY Date: Tue, 17 Feb 2026 18:34:20 -0500 Subject: [PATCH 02/13] Update lab_1a.py --- labs/lab_1/lab_1a.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labs/lab_1/lab_1a.py b/labs/lab_1/lab_1a.py index 4119259e..f123b741 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -1,6 +1,6 @@ """ lab_1a.py - +This is to simulate a change made on a robot: robot_speed = 5 # m/s The first lab in the BWSI CSS course. To complete this lab, fill out the variable on line 10 with your name. Then, save the code, add it to the staging area, and commit it to the Git tree. """ From e4c2190e739c81e73e017c56b422d06a3c6683c2 Mon Sep 17 00:00:00 2001 From: AsianRYRY Date: Tue, 17 Feb 2026 18:50:13 -0500 Subject: [PATCH 03/13] Update lab_1a.py 5 --> 3 --- labs/lab_1/lab_1a.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labs/lab_1/lab_1a.py b/labs/lab_1/lab_1a.py index f123b741..da2675de 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -1,6 +1,6 @@ """ lab_1a.py -This is to simulate a change made on a robot: robot_speed = 5 # m/s +This is to simulate a change made on a robot: robot_speed = 3 # m/s The first lab in the BWSI CSS course. To complete this lab, fill out the variable on line 10 with your name. Then, save the code, add it to the staging area, and commit it to the Git tree. """ From cb5a00afe89ee1c947e3e62d9bbddef27fcc532d Mon Sep 17 00:00:00 2001 From: AsianRYRY Date: Tue, 17 Feb 2026 18:51:52 -0500 Subject: [PATCH 04/13] Update lab_1a.py 3-->5 --- labs/lab_1/lab_1a.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labs/lab_1/lab_1a.py b/labs/lab_1/lab_1a.py index da2675de..f123b741 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -1,6 +1,6 @@ """ lab_1a.py -This is to simulate a change made on a robot: robot_speed = 3 # m/s +This is to simulate a change made on a robot: robot_speed = 5 # m/s The first lab in the BWSI CSS course. To complete this lab, fill out the variable on line 10 with your name. Then, save the code, add it to the staging area, and commit it to the Git tree. """ From 246f2ed386967558f46e53249a804c94c605180d Mon Sep 17 00:00:00 2001 From: AsianRYRY Date: Tue, 17 Feb 2026 18:53:06 -0500 Subject: [PATCH 05/13] Update lab_1a.py 5-->3 --- labs/lab_1/lab_1a.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labs/lab_1/lab_1a.py b/labs/lab_1/lab_1a.py index f123b741..da2675de 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -1,6 +1,6 @@ """ lab_1a.py -This is to simulate a change made on a robot: robot_speed = 5 # m/s +This is to simulate a change made on a robot: robot_speed = 3 # m/s The first lab in the BWSI CSS course. To complete this lab, fill out the variable on line 10 with your name. Then, save the code, add it to the staging area, and commit it to the Git tree. """ From 03f03ee0790591e0bf4e77cf57cb0b9d9fbe96c2 Mon Sep 17 00:00:00 2001 From: AsianRYRY Date: Tue, 17 Feb 2026 18:58:24 -0500 Subject: [PATCH 06/13] Update lab_1a.py --- labs/lab_1/lab_1a.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labs/lab_1/lab_1a.py b/labs/lab_1/lab_1a.py index da2675de..f123b741 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -1,6 +1,6 @@ """ lab_1a.py -This is to simulate a change made on a robot: robot_speed = 3 # m/s +This is to simulate a change made on a robot: robot_speed = 5 # m/s The first lab in the BWSI CSS course. To complete this lab, fill out the variable on line 10 with your name. Then, save the code, add it to the staging area, and commit it to the Git tree. """ From 18f70557b9f3b14aff03ba4b7b7238ec7eaf0da5 Mon Sep 17 00:00:00 2001 From: AsianRYRY Date: Tue, 17 Feb 2026 19:00:02 -0500 Subject: [PATCH 07/13] changed from 3 to 8 --- labs/lab_1/lab_1a.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labs/lab_1/lab_1a.py b/labs/lab_1/lab_1a.py index da2675de..c06ae1fa 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -1,6 +1,6 @@ """ lab_1a.py -This is to simulate a change made on a robot: robot_speed = 3 # m/s +This is to simulate a change made on a robot: robot_speed = 8 # m/s The first lab in the BWSI CSS course. To complete this lab, fill out the variable on line 10 with your name. Then, save the code, add it to the staging area, and commit it to the Git tree. """ From 733eee7990b68f4f690d2a4f864ca45338825ba3 Mon Sep 17 00:00:00 2001 From: AsianRYRY Date: Tue, 17 Feb 2026 19:15:52 -0500 Subject: [PATCH 08/13] Update lab_1a.py 5-->3 --- labs/lab_1/lab_1a.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labs/lab_1/lab_1a.py b/labs/lab_1/lab_1a.py index f123b741..da2675de 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -1,6 +1,6 @@ """ lab_1a.py -This is to simulate a change made on a robot: robot_speed = 5 # m/s +This is to simulate a change made on a robot: robot_speed = 3 # m/s The first lab in the BWSI CSS course. To complete this lab, fill out the variable on line 10 with your name. Then, save the code, add it to the staging area, and commit it to the Git tree. """ From 9657e42138fba27dff40c027f4450d61f4068244 Mon Sep 17 00:00:00 2001 From: AsianRYRY Date: Wed, 18 Feb 2026 20:12:00 -0500 Subject: [PATCH 09/13] added user sanitization for number --- labs/lab_1/lab_1b.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/labs/lab_1/lab_1b.py b/labs/lab_1/lab_1b.py index e58dd957..adf046c0 100644 --- a/labs/lab_1/lab_1b.py +++ b/labs/lab_1/lab_1b.py @@ -36,14 +36,21 @@ def simple_calculator(operation: str, num1: float, num2: float) -> float: raise ValueError("Cannot divide by zero.") else: raise ValueError("Invalid operation. Please choose from 'add', 'subtract', 'multiply', or 'divide'.") +def input_sanitized_number(prompt: str) -> float: + while True: + try: + number=float(input(prompt)) + return number + except ValueError: + print("Invalid Input. Please put a valid input") def main(): print(f"===== Simple Calculator =====") # Ask the user for sample input - num1 = float(input("Enter the first number: ")) - num2 = float(input("Enter the second number: ")) + num1 = input_sanitized_number("Enter first number: ") + num2 = input_sanitized_number("Enter the second number: ") operation = input("Enter the operation (add, subtract, multiply, divide): ").strip().lower() # Perform the calculation and display the result From 31bb2d0826b480a03e75189791e4af04773c63f8 Mon Sep 17 00:00:00 2001 From: AsianRYRY Date: Wed, 18 Feb 2026 21:42:29 -0500 Subject: [PATCH 10/13] fix/operation sanitization The way it prints out is still not correct but I am done for now. --- labs/lab_1/lab_1b.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/labs/lab_1/lab_1b.py b/labs/lab_1/lab_1b.py index adf046c0..65e6128f 100644 --- a/labs/lab_1/lab_1b.py +++ b/labs/lab_1/lab_1b.py @@ -22,20 +22,24 @@ def simple_calculator(operation: str, num1: float, num2: float) -> float: Returns: float: The result of the operation. """ - - if operation == "add": - return num1 + num2 - elif operation == "subtract": - return num1 - num2 - elif operation == "multiply": - return num1 * num2 - elif operation == "divide": - if num2 != 0: - return num1 / num2 + while True: + if operation == "add": + return num1 + num2 + elif operation == "subtract": + return num1 - num2 + elif operation == "multiply": + return num1 * num2 + elif operation == "divide": + if num2 != 0: + return num1 / num2 + else: + raise ValueError("Cannot divide by zero.") else: - raise ValueError("Cannot divide by zero.") - else: - raise ValueError("Invalid operation. Please choose from 'add', 'subtract', 'multiply', or 'divide'.") + try: + print("Invalid operation") + operation = input("What is your operation: ") + except ValueError: + continue def input_sanitized_number(prompt: str) -> float: while True: try: From 48ad1bf529449818e738003ef80742c015aac9d2 Mon Sep 17 00:00:00 2001 From: AsianRYRY Date: Thu, 19 Feb 2026 17:39:40 -0500 Subject: [PATCH 11/13] Properly added operation sanitization --- labs/lab_1/lab_1b.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labs/lab_1/lab_1b.py b/labs/lab_1/lab_1b.py index 65e6128f..982270ba 100644 --- a/labs/lab_1/lab_1b.py +++ b/labs/lab_1/lab_1b.py @@ -1,6 +1,6 @@ """ lab_1b.py - +Recommit This is a script that implements a simple calculator. It takes two numbers and an operation, then performs the operation and returns the result. From dfa5a6fb3ba0c6fda0a8e9fa1382da743e688749 Mon Sep 17 00:00:00 2001 From: AsianRYRY Date: Thu, 19 Feb 2026 17:58:09 -0500 Subject: [PATCH 12/13] Had to reccomitt --- labs/lab_1/lab_1b.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labs/lab_1/lab_1b.py b/labs/lab_1/lab_1b.py index adf046c0..03e3dc17 100644 --- a/labs/lab_1/lab_1b.py +++ b/labs/lab_1/lab_1b.py @@ -1,6 +1,6 @@ """ lab_1b.py - +reccomit This is a script that implements a simple calculator. It takes two numbers and an operation, then performs the operation and returns the result. From d385d9ea3b45f73ccf3ee2d6e24a86f47495991c Mon Sep 17 00:00:00 2001 From: AsianRYRY Date: Sun, 22 Feb 2026 18:10:22 -0500 Subject: [PATCH 13/13] tests/simple_calc --- .github/workflows/run_test.yml | 32 ++++++++++++++++++++++++++++++++ labs/lab_1/lab_1b.py | 2 +- tests/tests_1b.py | 6 +----- 3 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/run_test.yml diff --git a/.github/workflows/run_test.yml b/.github/workflows/run_test.yml new file mode 100644 index 00000000..c45bcbfc --- /dev/null +++ b/.github/workflows/run_test.yml @@ -0,0 +1,32 @@ +name: simple_calculator unit test + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10"] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with Ruff + run: | + pip install ruff + ruff --format=github --target-version=py310 . + continue-on-error: true + - name: Test with pytest + run: | + coverage run -m pytest tests/tests_1b.py -v -s + - name: Generate Coverage Report + run: | + coverage report -m \ No newline at end of file diff --git a/labs/lab_1/lab_1b.py b/labs/lab_1/lab_1b.py index 982270ba..e3c6f0a7 100644 --- a/labs/lab_1/lab_1b.py +++ b/labs/lab_1/lab_1b.py @@ -37,7 +37,7 @@ def simple_calculator(operation: str, num1: float, num2: float) -> float: else: try: print("Invalid operation") - operation = input("What is your operation: ") + operation = input("What is your operation: ").strip().lower() except ValueError: continue def input_sanitized_number(prompt: str) -> float: diff --git a/tests/tests_1b.py b/tests/tests_1b.py index be6b822d..a8a8b3de 100644 --- a/tests/tests_1b.py +++ b/tests/tests_1b.py @@ -31,11 +31,7 @@ def test_division_by_zero(): with pytest.raises(ValueError, match="Cannot divide by zero."): simple_calculator("divide", 5, 0) # Test division by zero -def test_invalid_operation(): - with pytest.raises(ValueError, match="Invalid operation. Please choose from 'add', 'subtract', 'multiply', or 'divide'."): - simple_calculator("modulus", 5, 3) # Test for invalid operation - with pytest.raises(ValueError, match="Invalid operation. Please choose from 'add', 'subtract', 'multiply', or 'divide'."): - simple_calculator("", 5, 3) # Test for empty operation + if __name__ == "__main__": pytest.main() \ No newline at end of file