From c869ff13392c31580e16b52616f7acd879cbdbf8 Mon Sep 17 00:00:00 2001 From: ncasula01 Date: Mon, 23 Feb 2026 16:15:37 -0500 Subject: [PATCH 1/6] added name to lab_1a --- 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..0cc02c45 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 = "Neel Casula" # TODO: Insert your name between the double quotes print(f"{name}, Welcome to the CSS course!") From 6fae6f513de64439c8f51df03c299a510ef5c734 Mon Sep 17 00:00:00 2001 From: Neel-Casula <87829584+Neel-Casula@users.noreply.github.com> Date: Mon, 23 Feb 2026 21:49:11 -0500 Subject: [PATCH 2/6] add comment about robot speed variable --- labs/lab_1/lab_1a.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/labs/lab_1/lab_1a.py b/labs/lab_1/lab_1a.py index 0cc02c45..aaa64235 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -3,6 +3,8 @@ 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 40aa7c4b400b0ceda9672a4099f5bf4a6a34e5dc Mon Sep 17 00:00:00 2001 From: Neel-Casula <87829584+Neel-Casula@users.noreply.github.com> Date: Mon, 23 Feb 2026 21:55:21 -0500 Subject: [PATCH 3/6] lowered speed --- 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 aaa64235..65ecbfc7 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -4,7 +4,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 298b28457e7471936b506217423a46dfe22fb48d Mon Sep 17 00:00:00 2001 From: ncasula01 Date: Mon, 23 Feb 2026 21:55:31 -0500 Subject: [PATCH 4/6] increased speed --- 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 aaa64235..1b09cad7 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -4,7 +4,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 c940fdd6357640f95f192506878e0df0cd39b451 Mon Sep 17 00:00:00 2001 From: ncasula01 Date: Mon, 23 Feb 2026 22:07:37 -0500 Subject: [PATCH 5/6] fixed unsanitzied numbers --- labs/lab_1/lab_1b.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/labs/lab_1/lab_1b.py b/labs/lab_1/lab_1b.py index e58dd957..0fddd8a3 100644 --- a/labs/lab_1/lab_1b.py +++ b/labs/lab_1/lab_1b.py @@ -37,13 +37,21 @@ 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. 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 06c41acb283eede3487609c258613d1f2ecd756c Mon Sep 17 00:00:00 2001 From: ncasula01 Date: Mon, 23 Feb 2026 22:11:48 -0500 Subject: [PATCH 6/6] added sanitized operations --- labs/lab_1/lab_1b.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/labs/lab_1/lab_1b.py b/labs/lab_1/lab_1b.py index 0fddd8a3..65653949 100644 --- a/labs/lab_1/lab_1b.py +++ b/labs/lab_1/lab_1b.py @@ -45,6 +45,14 @@ def request_sanitized_number(prompt: str) -> float: except ValueError: print("Invalid input. Enter a valid number") +def request_operation(prompt: str) -> str: + while True: + operation = str(input(prompt)).strip().lower() + if operation != "add" and operation != "divide" and operation != "multiply" and operation != "subtract": + print("Input a valid operation") + else: + return operation + def main(): print(f"===== Simple Calculator =====") @@ -52,7 +60,7 @@ def main(): # Ask the user for sample input 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() + operation = request_operation("Enter the operation (add, subtract, multiply, divide): ") # Perform the calculation and display the result result = simple_calculator(operation, num1, num2)