Worksheet - List
Worksheet - List
Q3. What does the following code return? (a) [5, 10] (b) [10, 20]
list1 = [1, 2, 3, 4] (c) [5, 15] (d) [15, 20]
list1.index(3)
True/False
1. A list in Python can be resized dynamically. 7. The index() method returns the index of the
2. The append() method can add multiple last occurrence of an element in the list.
elements to a list simultaneously. 8. Lists support both positive and negative
3. A list in Python can contain duplicate indexing.
elements. 9. The sort() method creates a new sorted list
4. Slicing a list modifies the original list. without modifying the original list.
5. Lists are always mutable in Python. 10. Lists in Python are similar to arrays in C but
6. The del keyword can be used to remove a slice allow heterogeneous data types.
of elements from a list.
Case Study-Based Questions
Case Study 1: Q1. Write the Python code to calculate the total
A student records marks in three subjects: marks.
marks = [85, 78, 92, 4, 67] Q2. Find the highest mark in the list.
1
GURU HARKRISHAN PUBLIC SCHOOL KALKAJI SUBJECT : COMP. SC. / I.P.
NEW DELHI-110019 CLASS : XI-A & XI-C
CHAPTER : LIST IN PYTHON
WORKSHEET - LIST
Coding Questions
Q1. Design a program for a group of friends to share Q2. Write a program to manage customer feedback
expenses. The program should: ratings for a product. The program should:
(a) Allow users to input the expenses for each person (a) Accept ratings out of (1,2,3,4,5) from customers
and store them in a list. and store them in a list.
(b) Calculate the total and average expense. (b) Calculate the average rating.
(c) Identify who spent the most and the least. (c) Count and display how many customers gave a
(d) Display the expense list in descending order. rating above 3.
(d) Remove ratings below a user-defined threshold.