💡 This question looks simple, but it tests a very important Python concept: 👉 Difference between is (identity) and == (equality) Many beginners get confused here — and yes, this is a real interview-level trap question. 📌 Drop your answer in the comments and explain why you chose it. Let’s learn Python the right way, not just by memorizing syntax. #Python #PythonProgramming #CodingInterview #DataAnalytics #LearnPython #TechCareers #ProgrammingTips #Developer #InterviewPreparation
True
True Because Memory location of a and b is same Based on identity operator
a
True
Error
In Python, string literals may be interned for optimization. The expression "py" + "thon" is evaluated at compile time, producing the string "python". Since "python" is already a string literal, both a and b reference the same object in memory. The is operator checks object identity (same memory location), not value equality. Therefore, in this case: a is b # True correct answer is A. True.
True , because Python interns short string literals like "python" for memory optimization, making identical literals share the same object in memory and a is b checks object identity, returning True instantly since both point to the same interned string .
Output is True because here variable b is carrying "py" + "thon" it is adding this both strings and variable a is carrying value of "python" which means a and b having some values and is operator used to check both variables having some values or not so here both variables are same.
True .. bcq In Python, the( is )operator checks if two variables point to the exact same object in memory (object identity), while the == operator checks if their values are equal. So output is true 🥂