Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion labs/lab_1/lab_1a.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@

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():
print("Hello World!")

name = "" # TODO: Insert your name between the double quotes
name = "Emmanuel" # TODO: Insert your name between the double quotes

print(f"{name}, Welcome to the CSS course!")

Expand Down
14 changes: 13 additions & 1 deletion labs/lab_1/lab_1b.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,19 @@
and prints the result to the terminal window.

"""

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 simple_calculator(operation: str, num1: float, num2: float) -> float:
"""
Function that takes in two numbers and an operation (add, subtract, multiply, divide),
Expand Down