From a8df93f05a2272cccdd840637f48d663142f4bf8 Mon Sep 17 00:00:00 2001 From: mwang2028 Date: Sun, 15 Feb 2026 13:07:52 -0800 Subject: [PATCH 1/7] 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 9d15ec83..eea32ca2 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 = "Max Wang" # TODO: Insert your name between the double quotes print(f"{name}, Welcome to the CSS course!") From d7837e87b9e33739072409c849a6cb269b726829 Mon Sep 17 00:00:00 2001 From: mwang2028 Date: Sun, 15 Feb 2026 14:51:40 -0800 Subject: [PATCH 2/7] Update lab_1a.py description changed --- 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 eea32ca2..8c7ad591 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -1,6 +1,6 @@ """ lab_1a.py - +aaa 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 e49805b3bba1307bfa16acd84cc1897ec42ef489 Mon Sep 17 00:00:00 2001 From: mwang2028 Date: Sun, 15 Feb 2026 14:52:34 -0800 Subject: [PATCH 3/7] 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 8c7ad591..1df9055d 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -1,6 +1,6 @@ """ lab_1a.py -aaa +aaabbb 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 e0ab0f666a2c5aeb73e33a6ab32a710082d81d54 Mon Sep 17 00:00:00 2001 From: mwang2028 Date: Mon, 16 Feb 2026 09:15:03 -0800 Subject: [PATCH 4/7] Update lab_1b.py fixed input --- 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..4f743590 100644 --- a/labs/lab_1/lab_1b.py +++ b/labs/lab_1/lab_1b.py @@ -37,13 +37,20 @@ def simple_calculator(operation: str, num1: float, num2: float) -> float: else: raise ValueError("Invalid operation. Please choose from 'add', 'subtract', 'multiply', or 'divide'.") +def request_sanitized_number(prompt: str) -> float: + while True: + try: + number = float(input(prompt)) + return number + except ValueError: + print("Invalid input. Please enter a valid number.") 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 = request_sanitized_number("Enter the first number: ") + num2 = request_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 1f171dca6eb0e15b871fe48e2529b3427391a96c Mon Sep 17 00:00:00 2001 From: mwang2028 Date: Tue, 17 Feb 2026 21:52:14 -0800 Subject: [PATCH 5/7] changed path Fixed sanitize branch --- labs/lab_1/bwsi-intro-python.code-workspace | 11 +++++++++++ labs/lab_1/lab_1b.py | 13 +++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 labs/lab_1/bwsi-intro-python.code-workspace diff --git a/labs/lab_1/bwsi-intro-python.code-workspace b/labs/lab_1/bwsi-intro-python.code-workspace new file mode 100644 index 00000000..ade0b89a --- /dev/null +++ b/labs/lab_1/bwsi-intro-python.code-workspace @@ -0,0 +1,11 @@ +{ + "folders": [ + { + "path": "../../../bwsi-intro-python" + }, + { + "path": "../.." + } + ], + "settings": {} +} \ No newline at end of file diff --git a/labs/lab_1/lab_1b.py b/labs/lab_1/lab_1b.py index 4f743590..4f5cd909 100644 --- a/labs/lab_1/lab_1b.py +++ b/labs/lab_1/lab_1b.py @@ -44,6 +44,7 @@ def request_sanitized_number(prompt: str) -> float: return number except ValueError: print("Invalid input. Please enter a valid number.") + def main(): print(f"===== Simple Calculator =====") @@ -54,8 +55,16 @@ def main(): operation = input("Enter the operation (add, subtract, multiply, divide): ").strip().lower() # Perform the calculation and display the result - result = simple_calculator(operation, num1, num2) - print(f"The result of {operation}ing {num1} and {num2} is: {result}") + while True: + try: + operation = input("Enter the operation (add, subtract, multiply, divide): ").strip().lower() + result = simple_calculator(operation, num1, num2) + print(f"The result of {operation}ing {num1} and {num2} is: {result}") + break # Exit only after success + + except ValueError as e: + print(f"Error: {e}") + print("Please enter a valid operation.\n") if __name__ == "__main__": From ec6232185a14bc4a6e85ed88b3962f5141a8c322 Mon Sep 17 00:00:00 2001 From: mwang2028 Date: Sat, 21 Feb 2026 16:17:40 -0800 Subject: [PATCH 6/7] Create run_test.yml yes --- .github/workflows/run_test.yml | 0 1 file changed, 0 insertions(+), 0 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..e69de29b From 10d3fa5a4ad1676bfe45be7fe30ba6e44016aa6a Mon Sep 17 00:00:00 2001 From: mwang2028 Date: Sat, 21 Feb 2026 16:20:30 -0800 Subject: [PATCH 7/7] Update run_test.yml yes --- .github/workflows/run_test.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/run_test.yml b/.github/workflows/run_test.yml index e69de29b..e5b2ab35 100644 --- a/.github/workflows/run_test.yml +++ 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