+ 2
Please am really confused about typeerror and value error.. please i need help
2 Respuestas
+ 5
To see what causes this error we need your code.
+ 4
• TypeError is thrown when an operation or function is applied to an object of an inappropriate type.
• Example:
———————————-
‘2‘+2
>>> TypeError: must be str, not int
————————————
• Explanation:
You are trying to add a string (text) to an integer, which is not allowed
• ValueError is thrown when a function's argument is of an inappropriate type.
• Example:
————————————
int('abc')
>>> ValueError: invalid literal for int() with base 10: 'abc'
————————————
• Explanation:
You‘re trying to convert a string to an integer. ‚abc‘ are letters, not integers, so this error is raised.
Information taken from
https://www.tutorialsteacher.com/JUMP_LINK__&&__python__&&__JUMP_LINK/error-types-in-python
All credit goes to them.
Hope this helps 😊