Advertisements
Advertisements
Question
When do we get a TypeError?
Short Answer
Advertisements
Solution
A TypeError occurs when an operation or function is applied to an object of an inappropriate type.
Examples:
"2" + 3 # TypeError
len(10) # TypeError
3 + [1, 2] # TypeError
It can also occur when a function receives the wrong type or number of arguments.
shaalaa.com
Is there an error in this question or solution?
