ValueError
Python raises a value error when an operation receives an argument that has the right type but an inappropriate value.
Some situations that look like value errors are not reported as value errors, but as other kinds of errors. For example, a divison by zero is reported as a zero division error.
Note that the text of the error message depends on the implementation. Different versions of Python and different checking tools will give slightly different messages.
rectangle(-10, 10, red)ValueError: Invalid length for parameter `width`
triangle(200, 50, 50, red)ValueError: Value for parameter `angle` out of the allowed range [0, 180]
sqrt(-1)ValueError: math domain error

PyTamaro is a project created by the Lugano Computing Education Research Lab at the Software Institute of USI
Privacy Policy • Platform Version a9143b0 (Sun, 14 Dec 2025 12:09:46 GMT)