🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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+?

  1. A.int or None
  2. B.int | None
  3. C.int & None
  4. 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 →