From 26ebdd33c9ee61390764991ad02a36fd719bb84d Mon Sep 17 00:00:00 2001 From: shanilashraf239-cmyk Date: Sun, 22 Mar 2026 21:16:01 -0400 Subject: [PATCH 1/5] added shanil ashraf to lab_1a.py i added shanil ashraf into the blank string --- 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..8eb31eee 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 = "shanil ashraf" # TODO: Insert your name between the double quotes print(f"{name}, Welcome to the CSS course!") From 60ba0c0af6ce169a49c178a4d63482f3c0f80ae5 Mon Sep 17 00:00:00 2001 From: shanilashraf239-cmyk Date: Sun, 22 Mar 2026 21:23:29 -0400 Subject: [PATCH 2/5] new my intro print --- 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 8eb31eee..7109121e 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -11,6 +11,7 @@ def main(): name = "shanil ashraf" # TODO: Insert your name between the double quotes print(f"{name}, Welcome to the CSS course!") + print("I like playing soccer w my friends") if __name__ == "__main__": main() From 3e1bcecc6bfabca129d40d60b49b1a6795f9437d Mon Sep 17 00:00:00 2001 From: shanilashraf239-cmyk Date: Sun, 22 Mar 2026 21:27:02 -0400 Subject: [PATCH 3/5] changed my intro --- 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 7109121e..378b30ea 100644 --- a/labs/lab_1/lab_1a.py +++ b/labs/lab_1/lab_1a.py @@ -11,7 +11,7 @@ def main(): name = "shanil ashraf" # TODO: Insert your name between the double quotes print(f"{name}, Welcome to the CSS course!") - print("I like playing soccer w my friends") + print("I like playing badminton w my friends") if __name__ == "__main__": main() From 2b40da3e3b1827ef029fe6bf0c6590e8a155ad75 Mon Sep 17 00:00:00 2001 From: shanilashraf239-cmyk Date: Sun, 22 Mar 2026 21:37:21 -0400 Subject: [PATCH 4/5] add comment 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 378b30ea..94f6425e 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 a13adfa8a63c133bb3a2a8138b892a57d424ceaa Mon Sep 17 00:00:00 2001 From: shanilashraf239-cmyk Date: Mon, 23 Mar 2026 23:08:37 -0400 Subject: [PATCH 5/5] add user input sanitization --- labs/lab_1/lab_1b.py | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/labs/lab_1/lab_1b.py b/labs/lab_1/lab_1b.py index e58dd957..01f463c9 100644 --- a/labs/lab_1/lab_1b.py +++ b/labs/lab_1/lab_1b.py @@ -23,19 +23,12 @@ def simple_calculator(operation: str, num1: float, num2: float) -> float: float: The result of the operation. """ - if operation == "add": - return num1 + num2 - elif operation == "subtract": - return num1 - num2 - elif operation == "multiply": - return num1 * num2 - elif operation == "divide": - if num2 != 0: - return num1 / num2 - else: - raise ValueError("Cannot divide by zero.") - else: - raise ValueError("Invalid operation. Please choose from 'add', 'subtract', 'multiply', or 'divide'.") + while True: + try: + number = float(input(prompt)) + return number + except ValueError: + print("Invalid input. Please enter a valid number.") def main():