Help with programming hw

For this part, you could use the if-else code, like this:

operation = input()
if operation == “add”:
print(1+1)

For this you could use a while loop, and use the “break” command when the user types exit. And put the if-else inside the loop. Like this:

operation = “”

while operation != “exit”:
operation = input()
if operation == “add”:
print(1+1)
elif operation == “subtract”:
print(4-2)
elif operation == “multiply”:
print(5*2)
elif operation == “divide”:
print(10/5)
elif operation == “exit”:
break

^ So the whole thing could look something like that. I don’t know if this helped or not :sweat_smile::rose::two_hearts:

3 Likes