Mar-04-2020, 09:21 PM
I think he wants the result displayed, rather than the entered text.
eval() is risky, and should only be used if you can control its use. That said, this works:
eval() is risky, and should only be used if you can control its use. That said, this works:
num1 = input("Enter a number: ") symbol = input("input symbol: ") num2 = input("Enter a number: ") st = num1+symbol+num2 print(eval(st))
Output:Enter a number: 4
input symbol: *
Enter a number: 3
12