Computer Science
Consider the following code and find out the error:
tup1 = ('a', 'b', 'c')
tup1 = tup1 + d
Python Tuples
1 Like
Answer
The code will result in an Error because the variable d is not defined before it is used in the expression tup1 + d.
Answered By
2 Likes
Related Questions
Suppose
>>> d1 = { 1 : 'one' , 2: 'two' , 3: 'three' , 4: 'four'} >>> d2 = { 5 :'five', 6:'six' }Write the output of the following code:
>>> del d1[3] >>> print(d1) >>> d1.pop(4) >>> print(d1) >>> d1 [8] =' eight' >>> print(d1) >>> d1.clear() >>> print(d1)Consider the following code and find out the error:
tup1 = (10, 20, 30) tup2 = tup1 * (3, )Consider the following code and find out the error:
tup1 = ("Riya", ) * '4'Consider the following code and find out the error:
t1 = (10, 20, 30, 40) X, Y, Z = t1