Calculator in python

Description

Python Program to get a binary arthmetic expression and solve the expression.
Input:
12
+
9
Ouput:
21
Input:
4
*
5
Output:
20

Solution

num1=int(input("Enter first Number:"))
op=input("Enter Operation:")
num2=int(input("Enter Second Number:"))
if op=='+':
    result=num1+num2
elif op=='-':
    result=num1-num2
elif op=='*':
    result=num1*num2
elif op=='/':
    result=num1/num2
elif op=='%':
    result=num1%num2
else:
    result="invalid operation"
print(result)

Explanation

Based on the second input (operator) any one arthmetic operation in chained if will be done