From 9dd07a83ed7a5238af148ae3b6bb9097a56fa0c7 Mon Sep 17 00:00:00 2001 From: stefenk75-gif Date: Fri, 6 Mar 2026 17:00:37 -0600 Subject: [PATCH 01/10] 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 9d15ec837..b67efcc02 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 = "Stefen King" # TODO: Insert your name between the double quotes print(f"{name}, Welcome to the CSS course!") From a72e220393b26a5315a2f9c1253306b8b4625b24 Mon Sep 17 00:00:00 2001 From: stefenk75-gif Date: Fri, 6 Mar 2026 17:07:19 -0600 Subject: [PATCH 02/10] added personal description 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 b67efcc02..6df3185f7 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -11,6 +11,7 @@ def main(): name = "Stefen King" # TODO: Insert your name between the double quotes print(f"{name}, Welcome to the CSS course!") + print("Hello, my name is Stefen King. I'm a junior at Pass Christian High school in southern Mississippi. I love robotics, football, and music.") if __name__ == "__main__": main() From 9099897070846063064f3cf7590338735cf2ecfe Mon Sep 17 00:00:00 2001 From: stefenk75-gif Date: Fri, 6 Mar 2026 18:36:56 -0600 Subject: [PATCH 03/10] Add comment about lab instructions Added a comment explaining the purpose of the lab. --- 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 6df3185f7..85ef4243b 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 a6bdfd4b2c6410bfef8cdfc59c31505c3c10d070 Mon Sep 17 00:00:00 2001 From: stefenk75-gif Date: Fri, 6 Mar 2026 18:42:45 -0600 Subject: [PATCH 04/10] 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 85ef4243b..c4acc2125 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 213f2921818fd3ddfdbc41123045449791d83853 Mon Sep 17 00:00:00 2001 From: stefenk75-gif Date: Fri, 6 Mar 2026 18:58:11 -0600 Subject: [PATCH 05/10] Update robot_speed to 5 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 c4acc2125..85ef4243b 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 = 3 # m/s +This is to simulate a change made on a robot: robot_speed = 5 # m/s """ def main(): From cea1b61057023beeb0a1027aaa29745cfcd5e2b5 Mon Sep 17 00:00:00 2001 From: stefenk75-gif Date: Fri, 6 Mar 2026 18:58:49 -0600 Subject: [PATCH 06/10] 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 85ef4243b..c4acc2125 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 7698b30d6e74f61e4cc3735819eab161ba8e2f52 Mon Sep 17 00:00:00 2001 From: stefenk75-gif Date: Fri, 6 Mar 2026 19:06:39 -0600 Subject: [PATCH 07/10] revert back to 5 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 c4acc2125..85ef4243b 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 = 3 # m/s +This is to simulate a change made on a robot: robot_speed = 5 # m/s """ def main(): From 8a285d63711079d54072b0322d1d98305766c58e Mon Sep 17 00:00:00 2001 From: stefenk75-gif Date: Fri, 6 Mar 2026 19:10:02 -0600 Subject: [PATCH 08/10] 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 85ef4243b..c4acc2125 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 68f83cdd8750d110fa05a22290ec4510a022f8d6 Mon Sep 17 00:00:00 2001 From: stefenk75-gif Date: Fri, 6 Mar 2026 19:26:28 -0600 Subject: [PATCH 09/10] changed robot speed from 5 m/s to 8 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 85ef4243b..1f186e66e 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 2a7d3b2ddd44ec1d3b64f4ae2b6c2b5e876e74bb Mon Sep 17 00:00:00 2001 From: stefenk75-gif Date: Sat, 7 Mar 2026 20:18:12 -0600 Subject: [PATCH 10/10] Added user input sanitization allowed for the code to not break when the user doesn't put in the right input. --- labs/lab_1/lab_1b.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/labs/lab_1/lab_1b.py b/labs/lab_1/lab_1b.py index e58dd9578..c0e5b9be6 100644 --- a/labs/lab_1/lab_1b.py +++ b/labs/lab_1/lab_1b.py @@ -37,13 +37,27 @@ 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)) + return number + except ValueError: + print("Invalid input. Please 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