Question

1.
2.
3.
4.
Answer (Detailed Solution Below)

Option 3 : False True

Advertisement

Detailed Solution

सही उत्तर False True है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

What is the output of the following Python code? x = [1, 2]; y = [1, 2]; print(x is y, x == y) / निम्नलिखित Python कोड का आउटपुट क्या है? x = [1, 2]; y = [1, 2]; print(x is y, x == y)

1.
True True
2.
True False
3.
False True
4.
False False

Correct Answer: False True

x and y are two distinct list objects, so `is` (identity) is False; but they contain equal elements, so `==` (equality) is True. / x और y दो भिन्न सूची ऑब्जेक्ट हैं, अतः `is` (पहचान) False है; लेकिन उनमें समान तत्व हैं, अतः `==` (समानता) True है।

Downloaded from PrepSnap (prepsnap.in)