🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: References and Copying: all 10 questions

Quiz: References and Copying · Question 4 of 10

When should you use is instead of ==?

When should you use is instead of ==?

  1. A.When checking whether a value is None
  2. B.When comparing two strings
  3. C.When comparing two numbers
  4. D.Whenever the values are lists
Answer & explanation

Correct answer: When checking whether a value is None

There is only one None object, so is None is the correct and clear check. Use == for values.

Can you get the rest right without peeking?

Take the timed Quiz: References and Copying quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →