From 01df17578abb7527769dbf9fce3d180108c25372 Mon Sep 17 00:00:00 2001 From: Allen Sheng Date: Mon, 16 Mar 2026 15:14:17 -0400 Subject: [PATCH 1/5] 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..dcfeada7 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 = "Allen Sheng" # TODO: Insert your name between the double quotes print(f"{name}, Welcome to the CSS course!") From 3d4ec926e61d9ce7c526179b866e820204423314 Mon Sep 17 00:00:00 2001 From: Allen Sheng Date: Mon, 16 Mar 2026 15:29:12 -0400 Subject: [PATCH 2/5] Added self introduction to lab_1a.py --- 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 dcfeada7..ba28dd44 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -11,6 +11,7 @@ def main(): name = "Allen Sheng" # TODO: Insert your name between the double quotes print(f"{name}, Welcome to the CSS course!") + print ("I am 14 years old and I am in 9th grade.") if __name__ == "__main__": main() From e57460f7234083a1f5d963b4a1d3ed0eadad1363 Mon Sep 17 00:00:00 2001 From: AllenSheng2024 Date: Mon, 16 Mar 2026 15:54:59 -0400 Subject: [PATCH 3/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 ba28dd44..d5a25ad5 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 242048a06d127fc8927039618b0b7a329a3f2042 Mon Sep 17 00:00:00 2001 From: Allen Sheng Date: Mon, 16 Mar 2026 19:58:51 -0400 Subject: [PATCH 4/5] Update speed 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 d5a25ad5..e37d88b4 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 +This is to simulate a change made on a robot: robot_speed = 3 # 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 1b6ccd64708c5bdd03738e62f9bde61cb26bf577 Mon Sep 17 00:00:00 2001 From: Allen Sheng Date: Mon, 16 Mar 2026 20:32:21 -0400 Subject: [PATCH 5/5] Add user input sanitization --- labs/lab_1/lab_1b.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/labs/lab_1/lab_1b.py b/labs/lab_1/lab_1b.py index e58dd957..e1c61968 100644 --- a/labs/lab_1/lab_1b.py +++ b/labs/lab_1/lab_1b.py @@ -37,6 +37,20 @@ 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 (input(prompt)) + except ValueError: + print ("Invalid input. Please enter a valid number") + def main(): print(f"===== Simple Calculator =====")