Question 71
In Python, what exception is raised when trying to divide a number by zero?
ZeroDivisionError is raised when the second argument of a division or modulo operation is zero.
In Python, what exception is raised when trying to divide a number by zero?
ZeroDivisionError is raised when the second argument of a division or modulo operation is zero.
In Python, what exception is raised when looking up an invalid key in a dictionary?
KeyError is thrown when a dictionary key is not found in the set of existing keys.
In Python, what exception is raised when attempting to access an out-of-range index on a list?
IndexError is raised when a sequence subscript is out of range.
In Python, what exception is raised when an operation or function receives an argument that has the right type but an inappropriate value?
ValueError is raised when an argument has the correct data type but an invalid value (e.g., int('abc')).
In Python, what exception is raised when an operation is applied to an object of an inappropriate data type (e.g., 'hello' + 5)?
TypeError occurs when an operation or function is applied to an object of inappropriate type.