Hi all,

I was wondering if anyone can help with this calculator project I’m working on.

It shows I have an error with subtracting two numbers in line 8.

Here is the code :

`num1 = input("Enter a number : ")`

`sym1 = input("Enter a math symbol (+ , - ,* ,/) : ")`

`num2 = input("Enter another number : ")`

`if sym1 == '+':`

` (num1 + num2)`

`if sym1 == '-':`

` (num2 - num1)`

`if sym1 == '-':`

` (num1 - num2)`

`if sym1 == '*':`

` (num1 * num2)`

`if sym1 == '/':`

` (num1 / num2)`

`sum = float(num1)+float(num2)`

`sum1 = float(num1)*float(num2)`

`sub = float(num2)-float(num1)`

`sub1=float(num1)-float(num1)`

`div = float(num1)/float(num2)`

`print("The {0} of {1} and {2} is {3}" .format(num1, num2, sym1, sum, sum1, sub, sub1, div ))`

And here is the error:

`Traceback (most recent call last):`

`File "C:\Users\(some_user)\AppData\Local\Programs\Python\Python39-32\(some_project)", line 8, in <module>`

` (num2 - num1)`

`TypeError: unsupported operand type(s) for -: 'str' and 'str'`

Can anyone view this code and tell me the error in line 8, please?

(Anyone can tell the answer by replying to this post.)

Thanking you all in advance.

Regards,

Vaibhav Chakravarthi