+ 1
I need someone to help with an explanation of ValueError and TypeError.
4 ответов
+ 13
A TypeError occurs when an operation or function is applied to an object of inappropriate type.
A ValueError occurs when a built-in operation or function receives an argument that has the right type but an inappropriate value, and the situation is not described by a more precise exception such as IndexError.
Examples: passing arguments of the wrong type (e.g. passing a list when an int is expected) should result in a TypeError, but passing arguments with the wrong value (e.g. a number outside expected boundaries) should result in a ValueError.
+ 5
Just a quick refresher from the Python course lesson (second tab):
https://www.sololearn.com/learn/Python/2440/
0
Thanks y'all... I understand it now.