Skip to content
CodeKruPro

is versus ==

QuizEasy-MediumPython onlyAsked in: Capgemini, Infosys

== asks whether two values are equal. is asks whether two names point at the very same object. What does this print?

a = [1, 2]
b = [1, 2]
c = a
print(a == b, a is b, a is c)
  • True False True
  • True True True
  • False False True
  • True False False

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in