Computer Science
Consider the following code and find out the error:
T1 = (10, 20, 30, 40)
T2 = (40, 50, 60)
T1, T2, T3 = T1, T2
Python Tuples
3 Likes
Answer
The code will result in an Error because the number of variables on the left side of the assignment does not match the number of values on the right side.
Answered By
1 Like
Related Questions
Consider the following code and find out the error:
t = (10, 20, 30, 40) t[1] = 'o'Consider the following code and find out the error:
T1 = ('A') T2 = ('B', 'C', 3) T3 = T1 + T2t1 = (100, 200, "Global", 3, 3.5, "Exam", [1, 2], (30, 40), (3, 5, 3)) :
Consider the above tuple 't1' and answer the following questions:
(a) len(t1)
(b) 20 not in t1
(c) t1[-8:-4]
(d) t1[5:]
(e) t1.index(5)
(f) t1.index(3, 6)
(g) 10 in t1
(h) t1.count(3)
(i) any(t1)
(j) t1[2]*2
Write the output of the following statements:
(a) >>> tuple([10,20,40])
(b) >>> ("Tea",)*5
(c) >>> tuple ("Item")