← Quiz: Type Hints and Dataclasses: all 10 questions
Quiz: Type Hints and Dataclasses · Question 3 of 10
Which hint means "an int or None" in Python 3.10+?
Which hint means "an int or None" in Python 3.10+?
- A.int or None
- B.int | None
- C.int & None
- D.[int, None]
Answer & explanation
Correct answer: int | None
The | form is the modern spelling of Optional[int].
Can you get the rest right without peeking?
Take the timed Quiz: Type Hints and Dataclasses quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →