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
5 changes: 4 additions & 1 deletion labs/lab_1/lab_1a.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@

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 = "shanil ashraf" # TODO: Insert your name between the double quotes

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i like ur name


print(f"{name}, Welcome to the CSS course!")
print("I like playing badminton w my friends")

if __name__ == "__main__":
main()
19 changes: 6 additions & 13 deletions labs/lab_1/lab_1b.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():

Expand Down