PythonTypeError: can only concatenate str (not int) to str














































PythonTypeError: can only concatenate str (not int) to str



pythonTypeError: can only concatenate str (not "int") to str


TypeError occurs when you made a function call or use an operator on incorrect data type.

for example: Let's see what happens when two incompatible types concatenates.




Here the '+' operator expected to add two character parameters. Python throws a TypeError which tells us that one of the parameters is of incorrect type.




To solve this error, just set 'a' as '3'.




And the result will be:




Use Try and Except in python. When an error occurs, python generate an exception which 
can be handled.


Exceptions can be used for handling errors in the program. When you think your code will generate an error,  then you can use exception handling.




The result of program will be:






Comments