From e36b465588de12f4c0eb9780667721086d06874b Mon Sep 17 00:00:00 2001 From: nsapience Date: Fri, 27 Feb 2026 16:13:21 -0800 Subject: [PATCH 1/4] Add name to 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..4854e71e 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 = "Nidhi Sreekanth" # TODO: Insert your name between the double quotes print(f"{name}, Welcome to the CSS course!") From 023fab274f27ef5e7f76481c4a3d26470ef19dad Mon Sep 17 00:00:00 2001 From: nsapience <111210074+nsapience@users.noreply.github.com> Date: Sat, 14 Mar 2026 18:59:41 -0700 Subject: [PATCH 2/4] 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..221ae318 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 abb96b9c7afa6a5b5625dc1503694aa4b15a21ca Mon Sep 17 00:00:00 2001 From: nsapience Date: Sat, 14 Mar 2026 22:54:57 -0700 Subject: [PATCH 3/4] add user input sanitization --- labs/lab_1/lab_1b.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/labs/lab_1/lab_1b.py b/labs/lab_1/lab_1b.py index e58dd957..30f531ad 100644 --- a/labs/lab_1/lab_1b.py +++ b/labs/lab_1/lab_1b.py @@ -41,10 +41,16 @@ 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: ")) - operation = input("Enter the operation (add, subtract, multiply, divide): ").strip().lower() + while True: + num1 = input("Enter the first number: ") + num2 = input("Enter the second number: ") + if num1.isdigit() and num2.isdigit(): + num1 = int(num1) + num2 = int(num2) + operation = input("Enter the operation (add, subtract, multiply, divide): ").strip().lower() + break + else: + print("Input is not a number.") # Perform the calculation and display the result result = simple_calculator(operation, num1, num2) From 8f12d8957b6e69e40fad15df4dc46e538d85cc93 Mon Sep 17 00:00:00 2001 From: nsapience Date: Sun, 15 Mar 2026 16:12:40 -0700 Subject: [PATCH 4/4] Add unit tests for simple calculatory --- .github/workflows/run_test.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) 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