From 653491102b97a7da959327650b601a1c9ac95047 Mon Sep 17 00:00:00 2001 From: sir_vector <139803240+sir-vector@users.noreply.github.com> Date: Mon, 9 Mar 2026 17:24:59 -0700 Subject: [PATCH 1/9] Added name to main function! --- 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..454011bc 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 = "Aditya" # TODO: Insert your name between the double quotes print(f"{name}, Welcome to the CSS course!") From d9aa2a85921a711456947dd4f9d84a2a2e1088a5 Mon Sep 17 00:00:00 2001 From: sir_vector <139803240+sir-vector@users.noreply.github.com> Date: Mon, 9 Mar 2026 18:03:20 -0700 Subject: [PATCH 2/9] Add name to lab_1a.py Added 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 454011bc..c05c664b 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 = "Aditya" # TODO: Insert your name between the double quotes + name = "Aditya Meruga" # TODO: Insert your name between the double quotes print(f"{name}, Welcome to the CSS course!") From 1dd3813d757edeb73947f0ca5b5bdc398d339d55 Mon Sep 17 00:00:00 2001 From: sir_vector <139803240+sir-vector@users.noreply.github.com> Date: Mon, 9 Mar 2026 19:58:37 -0700 Subject: [PATCH 3/9] Add robot_speed variable to lab_1a.py Added robot_speed variable to set speed in m/s. --- labs/lab_1/lab_1a.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/labs/lab_1/lab_1a.py b/labs/lab_1/lab_1a.py index c05c664b..4a3a6c3f 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -1,5 +1,8 @@ """ lab_1a.py +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 4a948acf13e50eb5ced32825e8f84cf0cba70370 Mon Sep 17 00:00:00 2001 From: sir_vector <139803240+sir-vector@users.noreply.github.com> Date: Mon, 9 Mar 2026 21:06:30 -0700 Subject: [PATCH 4/9] Change robot speed from 5 m/s to 3 m/s --- 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 4a3a6c3f..0fdc8deb 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -1,6 +1,6 @@ """ lab_1a.py -robot_speed = 5 # m/s +robot_speed = 3 # m/s From 00238fba5e0c5fd734fa73dfb6eb229f8752538a Mon Sep 17 00:00:00 2001 From: sir_vector <139803240+sir-vector@users.noreply.github.com> Date: Mon, 9 Mar 2026 21:07:41 -0700 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 4a3a6c3f..bf41a334 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -1,6 +1,6 @@ """ lab_1a.py -robot_speed = 5 # m/s +robot_speed = 8 # m/s From 38c02609a22454b053f5d900a2d731ff68cba59f Mon Sep 17 00:00:00 2001 From: sir_vector <139803240+sir-vector@users.noreply.github.com> Date: Wed, 11 Mar 2026 23:18:37 -0700 Subject: [PATCH 6/9] Update lab_1b.py --- labs/lab_1/lab_1b.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/labs/lab_1/lab_1b.py b/labs/lab_1/lab_1b.py index e58dd957..e6845cdf 100644 --- a/labs/lab_1/lab_1b.py +++ b/labs/lab_1/lab_1b.py @@ -37,13 +37,23 @@ def simple_calculator(operation: str, num1: float, num2: float) -> float: else: raise ValueError("Invalid operation. Please choose from 'add', 'subtract', 'multiply', or 'divide'.") +def valid_number(prompt: str) -> float: + valid = False + while valid == False: + try: + number = float(input(prompt)) + valid = True # only reaches here if float() worked + except ValueError: + print("That's not a number, try again!") + return 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 = valid_number("Enter the first number: ") + num2 = valid_number("Enter the second number: ") operation = input("Enter the operation (add, subtract, multiply, divide): ").strip().lower() # Perform the calculation and display the result From 9901584ed0a2fef62d4b519a135d62c8db8ee059 Mon Sep 17 00:00:00 2001 From: sir_vector <139803240+sir-vector@users.noreply.github.com> Date: Wed, 11 Mar 2026 23:33:34 -0700 Subject: [PATCH 7/9] Update lab_1b.py --- labs/lab_1/lab_1b.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/labs/lab_1/lab_1b.py b/labs/lab_1/lab_1b.py index e6845cdf..a6ccc24e 100644 --- a/labs/lab_1/lab_1b.py +++ b/labs/lab_1/lab_1b.py @@ -47,6 +47,16 @@ def valid_number(prompt: str) -> float: print("That's not a number, try again!") return number +def valid_operation(prompt: str) -> str: + valid_operation= False + while valid_operation == False: + operation = input(prompt) + if operation == "add" or operation == "subtract" or operation == "multiply" or operation == "divide": + valid_operation = True + else: + print("That's not a valid operation!") + return operation + def main(): print(f"===== Simple Calculator =====") @@ -54,7 +64,7 @@ def main(): # Ask the user for sample input num1 = valid_number("Enter the first number: ") num2 = valid_number("Enter the second number: ") - operation = input("Enter the operation (add, subtract, multiply, divide): ").strip().lower() + operation = valid_operation("Enter the operation (add, subtract, multiply, divide): ") # Perform the calculation and display the result result = simple_calculator(operation, num1, num2) From a404e540e5a2f7c0d9a3e860a18a92c1e99ce611 Mon Sep 17 00:00:00 2001 From: sir_vector <139803240+sir-vector@users.noreply.github.com> Date: Thu, 12 Mar 2026 21:15:13 -0700 Subject: [PATCH 8/9] Create run_test.yml --- .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 106919c2f7cdfb563a47830d8f2bf4fdb072a8ab Mon Sep 17 00:00:00 2001 From: sir_vector <139803240+sir-vector@users.noreply.github.com> Date: Thu, 12 Mar 2026 21:17:45 -0700 Subject: [PATCH 9/9] Update run_test.yml --- .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..1bd3e50e 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 \ No newline at end of file