CBSE Class 12 Computer Science Question 88 of 105

Python Revision Tour II — Question 15

Back to all questions
15
Question

Question 8

What will be the output of the following code ?

tuple_a = 'a', 'b'  
tuple_b = ('a',  'b')  
print (tuple_a == tuple_b)  
Answer
Output
True
Explanation

Tuples can be declared with or without parentheses (parentheses are optional). Here, tuple_a is declared without parentheses where as tuple_b is declared with parentheses but both are identical. As both the tuples contain same values so the equality operator ( == ) returns true.