How can I use an arithmetic operator (input by the user as a string) in an operation? I can print the operation itself, but I want to print the solution!
Here's my clumsy attempt:
# Initialise variables
x = 2
y = 3
# Prompt the user for an arithmetic operator
operator = input("Please enter *, /, +, or - : ")
# Calculate the operation
result = (str(x) + operator + str(y))
# Display the result
print(result)