Post

PythonPython

H
Harshel Mike

Posted on 26th February 2024|15 views

0
votes

Unsupported Operand Type(s)

Why do we get the TypeError: unsupported operand type(s)?

Answers
P
Athiq mohd

Posted on 26th February 2024

You see this error because you may be operating any operation that you needed to do on the integer, but the variables are a string

Let us see an example:

a=’4’

b=’2’

a-b

The ‘a-b’ line will throw this error because ‘-’ operation is not supported upon strings.

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos