[Solved] how to take (6+5) as a single input from user in python and display the result [closed]


Here is a simple calculator example to help get you started.

while True:
    num1 = input('First Number: ')
    num2 = input('Second Number: ')
    op = input('Operator: ')

    try:
        num1 = int(num1)
        num2 = int(num2)
    except:
        print('Input a valid number!')
        continue

    if op not in ['+', '-', '*']:
        print('Invalid operator!')
        continue

    if op == '+':
        print(str(num1 + num2))
    elif op == '-':
        print(str(num1 - num2))
    elif op == '*':
        print(str(num1 * num2))

2

solved how to take (6+5) as a single input from user in python and display the result [closed]