make calculatrice using python code example

Example 1: basic calculator in python

#My Personal Python calculator
print("My Personal Python calculator")
#inputs
num1 = int(input('Enter the first number:  '))
num2 = int(input('Enter the second number:  '))
#opration req
opr = input('Enter the type of operation you want to perform between your chosen two numbers:  ')
#calculation
if opr=='+':
    ans = num1 + num2
    # displaying the answer
    print(f'Your final answer is {ans}')
elif opr == '- ':
    ans = num1 - num2
    # displaying the answer
    print(f'Your final answer is {ans}')
elif opr=='*':
    ans = num1 * num2;
    # displaying the answer
    print(f'Your final answer is {ans}')
elif opr=='/':
    ans = num1 / num2
    # displaying the answer
    print(f'Your final answer is {ans}')
else:
    print('Invalid Entry!!!')

Example 2: python calculator

print("Choose operator (+,-,*,/):")
mode = input()
print("Choose first int:")
x = int(input())
print("Choose second int:")
y = int(input())

print("Your result:")
if mode == "+":
    print(x+y)
elif mode == "-":
    print(x-y)
elif mode == "*":
    print(x*y)
elif mode == "/":
    print(x/y)