Computer Science
Related Questions
Predict the output.
tuple_a = 'a', 'b' tuple_b = ('a', 'b') print (tuple_a == tuple_b)
Find the error. Following code intends to create a tuple with three identical strings. But even after successfully executing following code (No error reported by Python), The len( ) returns a value different from 3. Why ?
tup1 = ('Mega') * 3 print(len(tup1))
Predict the output.
x = (1, (2, (3, (4,)))) print(len(x)) print( x[1][0] ) print( 2 in x ) y = (1, (2, (3,), 4), 5) print( len(y) ) print( len(y[1])) print( y[2] + 50 ) z = (2, (1, (2, ), 1), 1) print( z[z[z[0]]])
What will the following code produce ?
Tup1 = (1,) * 3 Tup1[0] = 2 print(Tup1)