Question 1
tuple = (1, 2, 3, 4)
tuple.append( (5, 6, 7) )
print(len(my_tuple))
Question 2
tuple = {}
tuple[(1,2,4)] = 8
tuple[(4,2,1)] = 10
tuple[(1,2)] = 12
_sum = 0
for k in tuple:
_sum += tuple[k]
print(len(tuple) + _sum)
Question 3
tuple1 = (1, 2, 4, 3)
tuple2 = (1, 2, 3, 4)
print(tuple1 < tuple2)
Question 4
tuple = (1, 2, 3)
print(2 * tuple)
Question 5
tuple=(\"Check\")*3
print(tuple)
Question 6
T = \'geeks\'
a, b, c, d, e = T
b = c = \'*\'
T = (a, b, c, d, e)
print(T)
Question 7
T = (2e-04, True, False, 8, 1.001, True)
val = 0
for x in T:
val += int(x)
print(val)
Question 8
L = [3, 1, 2, 4]
T = (\'A\', \'b\', \'c\', \'d\')
L.sort()
counter = 0
for x in T:
L[counter] += int(x)
counter += 1
break
print(L)
Question 9
L = [2e-04, \'a\', False, 87]
T = (6.22, \'boy\', True, 554)
for i in range(len(L)):
if L[i]:
L[i] = L[i] + T[i]
else:
T[i] = L[i] + T[i]
break
Question 10
import sys
L1 = tuple()
print(sys.getsizeof(L1), end = \" \")
L1 = (1, 2)
print(sys.getsizeof(L1), end = \" \")
L1 = (1, 3, (4, 5))
print(sys.getsizeof(L1), end = \" \")
L1 = (1, 2, 3, 4, 5, [3, 4], \'p\', \'8\', 9.777, (1, 3))
print(sys.getsizeof(L1))
There are 11 questions to complete.