Lab Description:
This lab is similar like lab 2. I learned how to assign values to letters and evaluate it using python. I tried out few, with the addition, subtraction and multiplication and it worked. I gain some experienced while practicing on this lab because at first I couldn’t figure out what I was doing but later I did it with ease
Code:
input(“Press enter to continue”)
x = eval(input(“Enter a number for x:”))
y = eval(input(“Enter a number for y:”))
print(“Option 1. Sum”)
print(“Option 2. Subtract”)
print(“Option 3. Multiply”)
print(“Option 4. Divide”)
print(“Option 5. Remainder”)
print(“Option 6. Compare”)
print(“Option 7. Exit”)
print(input(“Select option: “))
if(“1”):
print(“Option 1. Sum”)
print(“x + y =”)
print(x + y)
if(“2”):
print(“Option 2. Subtract”)
print(“x – y =”)
print(x – y)
if(“3”):
print(“Option 3. Multiply”)
print(“x * y =”)
print(x * y)
if(“4”):
print(“Option 4. Divide”)
print(“x / y =”)
print(x / y)
if(“5”):
print(“Option 5. Remainder”)
print(“x % y =”)
print(x % y)
if(“6”):
print(“Option 6. Compare”)
print(“x == y =”)
print(x == y)