Question bank python_Module3_updated
Question bank python_Module3_updated
Module 3: Lists—Tuples—Sets
Lists
5. How does the in and not in operators work in a list? Illustrate with examples.
6. Compare two lists using comparison operators and explain the output.
7. Write a Python program to demonstrate membership and comparison operations on
lists.
8. List and explain any five commonly used list methods with examples.
9. Write a program using append(), insert(), remove(), sort(), and reverse() on a list.
10. Write a function that accepts a list and returns the sum of all its elements.
11. What are multidimensional lists? Create a 2D list and access its elements.
12. Define List? Explain append (), insert () and remove () methods with examples.
13. How is a tuple different from a list and what function is used to convert list to tuple?
Explain.
14. Explain different ways to delete an element from a list with suitable Python
syntax and programming examples
15. Explain append() and index() functions with respect to lists in Python.
16. Write the output of the following python code >>>spam=’Hello worls!’
i) >>> spam[0] ii) >>>spam[4] iii) >>>spam[-1] iv) >>>spam[0:5]
v) >>> spam[:5] vi) >>>spam[7:]
17 explain following methods used in list with an example.
i. len() ii. sum() iii) max() iv) min
18. What is the difference between a multidimensional list and a nested list with
examples?
19 Explain the difference between a List and a Generator in Python.
20. What is the difference between remove() and pop() methods in lists?
Tuples
Set