From 08f05d65e51ecd9fafa594a396c0de8f1411308e Mon Sep 17 00:00:00 2001 From: Elsa Guan Date: Sat, 21 Feb 2026 00:47:39 -0500 Subject: [PATCH 1/9] Update lab_1a.py add 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..8e219ec3 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 = "Elsa Guan" # TODO: Insert your name between the double quotes print(f"{name}, Welcome to the CSS course!") From e89b4a078ebdd0e12c030114e682fc8d6bed878d Mon Sep 17 00:00:00 2001 From: Elsa Guan Date: Sat, 21 Feb 2026 00:56:59 -0500 Subject: [PATCH 2/9] Update lab_1a.py practice for lab 1 --- labs/lab_1/lab_1a.py | 1 + 1 file changed, 1 insertion(+) diff --git a/labs/lab_1/lab_1a.py b/labs/lab_1/lab_1a.py index 8e219ec3..5022e173 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -11,6 +11,7 @@ def main(): name = "Elsa Guan" # TODO: Insert your name between the double quotes print(f"{name}, Welcome to the CSS course!") + print("good job Elsa") if __name__ == "__main__": main() From c8634d0c12e1fd31230ea54d28fe12dc72b5d780 Mon Sep 17 00:00:00 2001 From: Elsa Guan Date: Sat, 21 Feb 2026 01:01:12 -0500 Subject: [PATCH 3/9] add comment about robot speed --- labs/lab_1/lab_1a.py | 1 + 1 file changed, 1 insertion(+) diff --git a/labs/lab_1/lab_1a.py b/labs/lab_1/lab_1a.py index 5022e173..915c6d42 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -3,6 +3,7 @@ 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. +This is to simulate a change made on a robot: robot_speed = 5 # m/s """ def main(): From fba6ed298e6150c2f43f090d4add1996023c5fd7 Mon Sep 17 00:00:00 2001 From: Elsa Guan Date: Sat, 21 Feb 2026 01:08:47 -0500 Subject: [PATCH 4/9] change speed from 5 to 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 915c6d42..16ebaf5e 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -3,7 +3,7 @@ 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. -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 """ def main(): From 7695a60cff39abcddfd170d5b0edd3d268237fe5 Mon Sep 17 00:00:00 2001 From: Elsa Guan Date: Sat, 21 Feb 2026 01:10:01 -0500 Subject: [PATCH 5/9] 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 915c6d42..01215359 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -3,7 +3,7 @@ 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. -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 = 8 # m/s """ def main(): From f8ea11fb82c06ea0e167d98199173d2f6837a898 Mon Sep 17 00:00:00 2001 From: Elsa Guan Date: Sat, 21 Feb 2026 12:05:44 -0500 Subject: [PATCH 6/9] Update lab_1b.py fix bug: only number no string --- labs/lab_1/lab_1b.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/labs/lab_1/lab_1b.py b/labs/lab_1/lab_1b.py index e58dd957..a0a2653b 100644 --- a/labs/lab_1/lab_1b.py +++ b/labs/lab_1/lab_1b.py @@ -36,14 +36,20 @@ 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 ask_for_number_input(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 = ask_for_number_input("Enter the first number: ") + num2 = ask_for_number_input("Enter the second number: ") operation = input("Enter the operation (add, subtract, multiply, divide): ").strip().lower() # Perform the calculation and display the result From 09f65e53fa9969d36c7b12a3efb871b68515e73c Mon Sep 17 00:00:00 2001 From: Elsa Guan Date: Sat, 21 Feb 2026 12:34:33 -0500 Subject: [PATCH 7/9] Update lab_1b.py fix bug: only add... can be accepted --- labs/lab_1/lab_1b.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/labs/lab_1/lab_1b.py b/labs/lab_1/lab_1b.py index a0a2653b..671060be 100644 --- a/labs/lab_1/lab_1b.py +++ b/labs/lab_1/lab_1b.py @@ -43,6 +43,13 @@ def ask_for_number_input(prompt: str) -> float: return number except ValueError: print("Invalid input. Please enter a valid number.") +def ask_for_operation_input(prompt: str) -> str: + while True: + operation=str(input(prompt)) + if operation in ["add", "subtract", "multiply", "divide"]: + return operation + else: + print("Invalid input. Please enter a valid operation (add, subtract, multiply, divide).") def main(): print(f"===== Simple Calculator =====") @@ -50,7 +57,7 @@ def main(): # Ask the user for sample input num1 = ask_for_number_input("Enter the first number: ") num2 = ask_for_number_input("Enter the second number: ") - operation = input("Enter the operation (add, subtract, multiply, divide): ").strip().lower() + operation = ask_for_operation_input("Enter the operation (add, subtract, multiply, divide): ").strip().lower() # Perform the calculation and display the result result = simple_calculator(operation, num1, num2) From 2434091eee1bf6a26377ffa7ff0f4d33798be88c Mon Sep 17 00:00:00 2001 From: Elsa Guan Date: Sat, 21 Feb 2026 21:10:30 -0500 Subject: [PATCH 8/9] Create run_test.yml. Sets up a mini Ubuntu environment with a Python 3.10 runner Installs dependencies via requirements.txt Runs the unit test using Pytest and generates a coverage report Prints the coverage report to the console --- .github/run_test.yml. | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/run_test.yml. diff --git a/.github/run_test.yml. b/.github/run_test.yml. new file mode 100644 index 00000000..c45bcbfc --- /dev/null +++ b/.github/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 From 352cc5a1b716c1845acb55138c43555cc404248e Mon Sep 17 00:00:00 2001 From: Elsa Guan Date: Sat, 21 Feb 2026 21:16:12 -0500 Subject: [PATCH 9/9] Create main.yml --- .github/workflows/main.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..467613ce --- /dev/null +++ b/.github/workflows/main.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