← Quiz: Exceptions and Files: all 15 questions
Quiz: Exceptions and Files · Question 10 of 15
What does raise ValueError("bad age") do?
What does raise ValueError("bad age") do?
- A.Prints "bad age" and continues
- B.Raises a ValueError that callers can catch
- C.Creates a variable named ValueError
- D.Nothing outside a try block
Answer & explanation
Correct answer: Raises a ValueError that callers can catch
raise signals an error.
Can you get the rest right without peeking?
Take the timed Quiz: Exceptions and Files quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →