Question 10
Back to Exercise
The program below stops with an error. Which statement correctly describes the problem?
def check(stock):
if stock < 0:
raise
return stock
check(-1)
- A It returns -1
- B ValueError
- C SyntaxError
- D RuntimeError: a bare raise re-raises the active exception, and there is none; raise a specific exception such as ValueError("negative stock") Correct
Correct Answer: Option D
Python reports "No active exception to reraise".
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!