1. Working with List
1. Create three lists – a heterogeneous list, integer list, a list of animals.
2. Print the ascending order of the integer list, and the animal list.
3. Print the maximum and minimum number in the integer list.
4. Find the sum of elements in the integer list.
5. Reverse a list with and without using a function.
6. Consider a new list L = [23, 67, 12, 45, 78, 15, 90, 76, 63, 76, 52, 123] and extract the
following sub-lists.
a. Reverse a list with and without a function.
b. Extract a list [123, 52, 76, 63, 76, 90, 15, 78, 45, 12, 67, 23]
c. [23, 12, 78, 90]
d. First occurrence and last occurrence of 76.
e. Find the count of 76 in the list.
f. Print the entire list using slice operation.
g. Print the elements from position 2 to 8 with an interval 2.
h. Print the element from position 4 using slice operation.
i. Print the elements up to position 8 using slice operation.
j. Print the elements from position 3 with an interval of 3.
k. Update the element 555 at position 7 through indexing.
l. Add an element 888 to the end of the list using function.
m. Delete the element at position 6 using indexing and element at position 2 using
function.
n. Generate an empty list List1.
o. Check the emptiness of the list.
p. Insert elements in to the list using for loop after getting the number of
elements in the list to be inserted.
q. Print the list 3 times using the required operator.
r. Append the list [“apple”, “banana”, “cherry”] with the generated list.
s. Write the effect of remove ( ) in the generated list.
t. What will happen if you put a string inside list( ) function. Illustrate with an
example.
u. Generate a list with single element without using [ ].
v. Find the length of the generated list.
7. Traverse and print the list elements in a single line with a tab space.
8. Make the heterogeneous list as an empty list without using any function.
9. Prove the list property “mutable”.
10. Generate a list with the cube values of the list [2, 7, 9] using list comprehension
technique.
Working with tuples:
1. Generate a integer tuple, a string tuple with your friends name, a heterogeneous list
with your name, roll number, 5 marks and its average.
2. Create and print an empty tuple.
3. Prove immutability of the tuple.
4. Try deleting an element from the list. What happens?
2. 5. Can you create a tuple inside a list?
6. Concatenate any two created tuples.
7. Find the min and max value in the tuple.
8. What will be the output when you convert a string to a tuple using the necessary
function.
9. Print the tuple for n times.
10. Compare two tuples after creating a tuple A and copying the same to tuple B.
11. What is tuple packing?
12. Find the index of third element in the tuple A.
13. Count the number of times x appears in the string “xaxxyxsttxggexxxxsx” using the
function count.
14. Can we convert the list into a tuple?
15. Illustrate the membership operators on a tuple.