21. What will be the output of the following code:
my_tuple = (1, 2, 3)
my_tuple[1] = 4
print(my_tuple)
my_tuple = (1, 2, 3)
my_tuple[1] = 4
print(my_tuple)
22. What is the output of the following code:
my_list = [1, 2, 3]
del my_list[1]
print(my_list)
my_list = [1, 2, 3]
del my_list[1]
print(my_list)
23. What will be the output of the following code:
my_list = [3, 1, 2]
my_list.sort()
print(my_list)
my_list = [3, 1, 2]
my_list.sort()
print(my_list)
24. What is the output of the following code:
my_list = [1, 2, 3]
my_list.insert(1, 4)
print(my_list)
my_list = [1, 2, 3]
my_list.insert(1, 4)
print(my_list)
25. What is the purpose of the count() method for lists and tuples?
26. What will be the output of the following code:
my_list = [1, 2, 3]
my_list.reverse()
print(my_list)
my_list = [1, 2, 3]
my_list.reverse()
print(my_list)
27. What is the output of the following code:
my_list = [1, 2, 3, 4]
my_list.pop()
print(my_list)
my_list = [1, 2, 3, 4]
my_list.pop()
print(my_list)
28. What is the output of the following code:
my_tuple = (1, 2, 3)
print(my_tuple[1])
my_tuple = (1, 2, 3)
print(my_tuple[1])
29. What is the output of the following code:
my_list = [1, 2, 3, 4]
my_list.remove(2)
print(my_list)
my_list = [1, 2, 3, 4]
my_list.remove(2)
print(my_list)
30. What will the following code output:
my_tuple = (1, 2, 3)
new_tuple = my_tuple.copy()
print(new_tuple)
my_tuple = (1, 2, 3)
new_tuple = my_tuple.copy()
print(new_tuple)