From 39319765661e095bc7638f09360904c22720f654 Mon Sep 17 00:00:00 2001 From: LawMorano Date: Tue, 17 Feb 2026 14:57:39 -0500 Subject: [PATCH 1/4] 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..56d8221e 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 = "Law Morano" # TODO: Insert your name between the double quotes print(f"{name}, Welcome to the CSS course!") From 0e536c993942431e58ff75e588ab859b33992654 Mon Sep 17 00:00:00 2001 From: LawMorano Date: Tue, 17 Feb 2026 15:19:33 -0500 Subject: [PATCH 2/4] Add self-introduction --- 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 56d8221e..c18bfdd0 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -11,6 +11,7 @@ def main(): name = "Law Morano" # TODO: Insert your name between the double quotes print(f"{name}, Welcome to the CSS course!") + print("Hello! I'm Law, and I'm a sophomore from North Carolina. I play NAL soccer and am the captain of my school's FTC team, 9581 Techno Tigers. We just qualified for states! I'm excited to learn more about all of you and expand my knowledge along with you all!") if __name__ == "__main__": main() From 544a03f535cc55e44db2261dd9a2a3ab5754ca5e Mon Sep 17 00:00:00 2001 From: LawMorano Date: Tue, 17 Feb 2026 15:23:24 -0500 Subject: [PATCH 3/4] Add commit about robot speed variable Added a comment explaining the purpose of the 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 c18bfdd0..6375b5d6 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 d3511cc4869c649c6c06b2f9b027c4f656cafd65 Mon Sep 17 00:00:00 2001 From: LawMorano Date: Sun, 8 Mar 2026 19:53:50 -0400 Subject: [PATCH 4/4] Add user input sanitization --- labs/lab_1/lab_1b.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/labs/lab_1/lab_1b.py b/labs/lab_1/lab_1b.py index e58dd957..fcf07728 100644 --- a/labs/lab_1/lab_1b.py +++ b/labs/lab_1/lab_1b.py @@ -9,6 +9,7 @@ """ + def simple_calculator(operation: str, num1: float, num2: float) -> float: """ Function that takes in two numbers and an operation (add, subtract, multiply, divide), @@ -36,14 +37,25 @@ def simple_calculator(operation: str, num1: float, num2: float) -> float: raise ValueError("Cannot divide by zero.") else: raise ValueError("Invalid operation. Please choose from 'add', 'subtract', 'multiply', or 'divide'.") + + +def request_santized_number(prompt: str) -> float: + + 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_santized_number("Enter the first number: ") + num2 = request_santized_number("Enter the second number: ") operation = input("Enter the operation (add, subtract, multiply, divide): ").strip().lower() # Perform the calculation and display the result