Write a Program to perform the Arithmetic Operation on two operands as per the input provided by the user.
And print out the result.
<code data-enlighter-language="python" class="EnlighterJSRAW">operand1 = float(input("Enter the first value: "))
operator = input("Enter a binary arithmetic operator (+, -, *, /, **, //, %): ")
operand2 = float(input("Enter the second second: "))
if operator == "-":
result = operand1 - operand2
elif operator == "*":
result = operand1 * operand2
elif operator == "+":
result = operand1 + operand2
elif operator == "/":
if operand2 != 0:
result = operand1 / operand2
else:
result = "Error: Division by zero"
elif operator == "**":
result = operand1 ** operand2
elif operator == "//":
if operand2 != 0:
result = operand1 // operand2
else:
result = "Error: Floor division by zero"
elif operator == "%":
if operand2 != 0:
result = operand1 % operand2
else:
result = "Error: Modulo division by zero"
else:
result = "Error: Invalid operator"
print(f"{operand1} {operator} {operand2} = {result}")
Operand 1 stores float value
Operand 2 stores float value
Operator stores string value

