Skip to content
క
kagitha
/
quiz
/
python-exceptions
Subscribe
Index
⌘K
JAVA NOTEBOOK · QUIZ 23 · BEGINNER
Python exceptions for Java developers
QUESTION 01 / 04
What is Python's version of Java's throw?
A
throw
B
raise
C
except
D
error
SCORE SO FAR · 0 / 0
Share this quiz ↗
What is Python's version of Java's throw?
— raise. raise ValueError("message") throws an exception. A bare raise inside an except block rethrows the current one.
Does Python have checked exceptions?
— No, nothing forces you to catch or declare exceptions. Python has no checked exceptions and no throws clause. Any function can raise anything, so read the library's docs to know what to handle.
AttributeError: 'NoneType' object has no attribute 'strip' is closest to which Java exception?
— NullPointerException. It means you called a method on None. Look for a function that returned nothing, or a dict.get() that found no key.
Where is the actual error in a Python traceback?
— The last line. Python prints the call stack with the newest call last, and the error type and message on the final line. Read tracebacks bottom up.
kagitha
Close
✕
Search everything — articles, videos, chapters, agents, books
01
AI
02
Java
03
System Design
04
Series
05
Manga
06
The Lab
07
Videos
08
Quizzes
09
Books
10
Resume