From 8d3241729a9f557ceb6d01deb86d2e3545eeb29a Mon Sep 17 00:00:00 2001 From: bill-tcs Date: Mon, 16 Feb 2026 20:28:27 -0500 Subject: [PATCH 1/5] Added my name to first lab --- 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..cc51ab9b 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 = "Nolan Purcell" # TODO: Insert your name between the double quotes print(f"{name}, Welcome to the CSS course!") From 7379b93f1258609cbc5212241660b8c08049fb93 Mon Sep 17 00:00:00 2001 From: nolan Date: Mon, 16 Feb 2026 20:47:41 -0500 Subject: [PATCH 2/5] Added introduction to lab_1a --- 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 cc51ab9b..f658e4ea 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -11,6 +11,7 @@ def main(): name = "Nolan Purcell" # TODO: Insert your name between the double quotes print(f"{name}, Welcome to the CSS course!") + print("Hello! My name is Nolan Purcell and I am a freshman from Florida. I like to play golf and play video games with my friends.") if __name__ == "__main__": main() From 4425da5bf9d4d6bd00974377b71bc86a53d09cb4 Mon Sep 17 00:00:00 2001 From: Coder203010 Date: Thu, 19 Feb 2026 16:25:52 -0500 Subject: [PATCH 3/5] Add comment about robot speed variable --- 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 f658e4ea..5e20941d 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -3,6 +3,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 """ def main(): From 5e65221143bb8d8d5efd85f9d1e56584e5c7f763 Mon Sep 17 00:00:00 2001 From: nolan Date: Thu, 19 Feb 2026 16:54:57 -0500 Subject: [PATCH 4/5] Fixed bug where calc would crash when non-number is put in input for number --- 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..ee492a0d 100644 --- a/labs/lab_1/lab_1b.py +++ b/labs/lab_1/lab_1b.py @@ -8,6 +8,14 @@ and prints the result to the terminal window. """ +def requestsanitizednum(prompt: str) -> float: + while True: + try: + number = float (input (prompt)) + return number + except ValueError: + print("Invalid input. Please enter a valid number.") + def simple_calculator(operation: str, num1: float, num2: float) -> float: """ @@ -42,8 +50,8 @@ 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 = requestsanitizednum("Enter the first number: ") + num2 = requestsanitizednum("Enter the second number: ") operation = input("Enter the operation (add, subtract, multiply, divide): ").strip().lower() # Perform the calculation and display the result From 7baaa6c385626165580a96f0b6ea0cf1c4a40f44 Mon Sep 17 00:00:00 2001 From: nolan Date: Thu, 19 Feb 2026 17:02:47 -0500 Subject: [PATCH 5/5] Fixed bug where incorrect operation input would crash calc --- labs/lab_1/lab_1b.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/labs/lab_1/lab_1b.py b/labs/lab_1/lab_1b.py index ee492a0d..660745e1 100644 --- a/labs/lab_1/lab_1b.py +++ b/labs/lab_1/lab_1b.py @@ -8,7 +8,7 @@ and prints the result to the terminal window. """ -def requestsanitizednum(prompt: str) -> float: +def sanitize_num(prompt: str) -> float: while True: try: number = float (input (prompt)) @@ -16,6 +16,13 @@ def requestsanitizednum(prompt: str) -> float: except ValueError: print("Invalid input. Please enter a valid number.") +def sanitize_op(prompt: str) -> str: + while True: + operation = str (input (prompt)) + if operation == "add" or operation == "subtract" or operation =="multiply" or operation =="divide": + return operation + else: + print("Invalid operation. Please enter a valid operation.") def simple_calculator(operation: str, num1: float, num2: float) -> float: """ @@ -50,9 +57,9 @@ def main(): print(f"===== Simple Calculator =====") # Ask the user for sample input - num1 = requestsanitizednum("Enter the first number: ") - num2 = requestsanitizednum("Enter the second number: ") - operation = input("Enter the operation (add, subtract, multiply, divide): ").strip().lower() + num1 = sanitize_num("Enter the first number: ") + num2 = sanitize_num("Enter the second number: ") + operation = sanitize_op("Enter the operation (add, subtract, multiply, divide): ").strip().lower() # Perform the calculation and display the result result = simple_calculator(operation, num1, num2)