31 lines
609 B
Python
31 lines
609 B
Python
|
|
# Created by Maxwell Jeffress, 11/02/2026
|
||
|
|
# Does add, subtract, multiply, and divide operations on 2 numbers.
|
||
|
|
|
||
|
|
left = 0
|
||
|
|
right = 0
|
||
|
|
|
||
|
|
|
||
|
|
# GET left (user input)
|
||
|
|
try:
|
||
|
|
left = int(input("Left side: "))
|
||
|
|
except ValueError:
|
||
|
|
print("Invalid input!")
|
||
|
|
exit(1)
|
||
|
|
|
||
|
|
# GET right (user input)
|
||
|
|
try:
|
||
|
|
right = int(input("Right side: "))
|
||
|
|
except ValueError:
|
||
|
|
print("Invalid input")
|
||
|
|
exit(1)
|
||
|
|
|
||
|
|
add = left + right
|
||
|
|
sub = left - right
|
||
|
|
mul = left * right
|
||
|
|
div = left / right
|
||
|
|
|
||
|
|
print("left + right =", add)
|
||
|
|
print("left - right =", sub)
|
||
|
|
print("left * right =", mul)
|
||
|
|
print("left / right =", div)
|