From d0d678849f0c239892917b17add2651d96c1d213 Mon Sep 17 00:00:00 2001 From: rishinarayan0303-ai Date: Mon, 23 Feb 2026 12:25:30 -0500 Subject: [PATCH 1/5] 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..b23b4f68 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 = "Rishi Nandgiri" # TODO: Insert your name between the double quotes print(f"{name}, Welcome to the CSS course!") From 1fdf7e59cbd1bf1e2bedfea96e4e9881538c3352 Mon Sep 17 00:00:00 2001 From: rishinarayan0303-ai Date: Mon, 23 Feb 2026 12:34:58 -0500 Subject: [PATCH 2/5] Update lab_1a.py New intro line --- 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 b23b4f68..85f23fa8 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -11,6 +11,6 @@ def main(): name = "Rishi Nandgiri" # TODO: Insert your name between the double quotes print(f"{name}, Welcome to the CSS course!") - + print(f"{name} is very happy to see you") if __name__ == "__main__": main() From 42c3e2a0e056b1e855035a099f9fe227adc19a9b Mon Sep 17 00:00:00 2001 From: rishinarayan0303-ai Date: Mon, 23 Feb 2026 12:45:13 -0500 Subject: [PATCH 3/5] Adding comment about robot speed variable Added a comment explaining the purpose of the variable --- 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 85f23fa8..94dd3dda 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 87e0987ae874c5c5d030ccc038a8afb65032faf7 Mon Sep 17 00:00:00 2001 From: rishinarayan0303-ai Date: Mon, 23 Feb 2026 20:37:15 -0500 Subject: [PATCH 4/5] fix/sanitize --- labs/lab_1/lab_1b.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/labs/lab_1/lab_1b.py b/labs/lab_1/lab_1b.py index e58dd957..094e2b0d 100644 --- a/labs/lab_1/lab_1b.py +++ b/labs/lab_1/lab_1b.py @@ -37,13 +37,28 @@ 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: + """ + Function to request and sanitize user input for the operation + + Returns: + float: The sanitized numeric input by the user + """ + while True: + try: + number = float(number(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 7f3d94e9475ba560f29065e1e9e90def009ba00e Mon Sep 17 00:00:00 2001 From: rishinarayan0303-ai Date: Mon, 23 Feb 2026 20:45:05 -0500 Subject: [PATCH 5/5] Update bug fix --- labs/lab_1/lab_1b.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labs/lab_1/lab_1b.py b/labs/lab_1/lab_1b.py index 094e2b0d..5b938b07 100644 --- a/labs/lab_1/lab_1b.py +++ b/labs/lab_1/lab_1b.py @@ -46,7 +46,7 @@ def request_sanitized_number(prompt: str) -> float: """ while True: try: - number = float(number(prompt)) + number = float(input(prompt)) return number except ValueError: print("Invalid input. Enter a valid number.")