List Manipulation in Python Class 11 Notes

List Manipulation in Python Class 11 Notes

Welcome to the complete List Manipulation in Python — Class 11 Notes. Lists are the most widely used data structure in the CBSE Computer Science / Informatics Practices syllabus, and almost every board paper carries 3–4 marks directly from this chapter. These notes cover the complete CBSE syllabus — indexing, all list operations, traversal, every built-in function/method, nested lists, and the suggested programs — with syntax, examples and outputs.

💡 Exam tip: Slicing and sort() vs sorted() are the two most repeated trick questions on Lists. Run every example yourself — typing the code is the fastest way to remember it.

Quick Overview — What You Will Learn

#TopicKey ConceptsExam Weight
1Introduction to ListsDefinition, creation, mutability⭐⭐
2List IndexingPositive index, negative index, IndexError⭐⭐⭐
3List OperationsConcatenation, Repetition, Membership, Slicing⭐⭐⭐
4Traversing a Listfor loop, while loop⭐⭐
5Built-in Functions/Methodslen(), append(), sort(), sorted(), etc.⭐⭐⭐
6Nested ListsList of lists, double indexing⭐⭐
7Suggested ProgramsMax/Min/Mean, Linear Search, Frequency Count⭐⭐⭐

Section 1 · Introduction · ⭐⭐

📦 What is a List in Python?

A list is an ordered, mutable collection of items enclosed in square brackets [ ], separated by commas. A list can store different data types together.

marks = [45, 67, 89, 23, 56]
subjects = [“Physics”, “Chemistry”, “Maths”, “CS”]
mixed = [10, “Amit”, 45.5, True] # different data types together
empty_list = [] # an empty list

List Mutability

Lists are mutable — unlike strings, individual elements CAN be changed after creation.

mylist = [“C”, “C++”, “Java”, “Python”, “PHP”]
mylist[2] = “Rust” # allowed — lists are mutable
print(mylist)

s = “Hello”
# s[0] = “h” # TypeError — strings are immutable

[‘C’, ‘C++’, ‘Rust’, ‘Python’, ‘PHP’]
💡 Why mutability matters for exams: “Are lists mutable or immutable?” is a common 1-mark question — and it explains why append(), sort() etc. change the original list directly.

Section 2 · Indexing · ⭐⭐⭐

🔢 List Indexing

Every element has a fixed position called its index. Python supports positive indexing (0 onward, left to right) and negative indexing (-1 onward, right to left).

ElementCC++JavaPythonPHP
Positive Index01234
Negative Index-5-4-3-2-1
mylist = [“C”, “C++”, “Java”, “Python”, “PHP”]

print(mylist[0]) # C
print(mylist[4]) # PHP (last element)
print(mylist[-1]) # PHP (last element)
print(mylist[-2]) # Python

print(mylist[10]) # IndexError: list index out of range

Formula: negative_index = positive_index − len(list)


Section 3 · List Operations · ⭐⭐⭐

⚙️ List Operations

CBSE defines four core operations — concatenation, repetition, membership, slicing.

1. Concatenation ( + )

list1 = [1, 2, 3]
list2 = [“a”, “b”]
print(list1 + list2)
[1, 2, 3, ‘a’, ‘b’]

2. Repetition ( * )

list1 = [1, 2, 3]
print(list1 * 3)
print([0] * 5) # common way to initialise a list
[1, 2, 3, 1, 2, 3, 1, 2, 3]
[0, 0, 0, 0, 0]

3. Membership ( in, not in )

mylist = [“C”, “C++”, “Java”, “Python”, “PHP”]
print(“C” in mylist) # True
print(“Ruby” not in mylist) # True
⚠️ in / not in are case-sensitive for strings.

4. Slicing

Syntax: list[start : stop : step] — the stop index is never included.

mylist = [“C”, “C++”, “Java”, “Python”, “PHP”]

print(mylist[2:5]) # stop excluded
print(mylist[:3]) # start omitted -> 0
print(mylist[2:]) # stop omitted -> end
print(mylist[::2]) # every 2nd element
print(mylist[::-1]) # reversed list

[‘Java’, ‘Python’, ‘PHP’]
[‘C’, ‘C++’, ‘Java’]
[‘Java’, ‘Python’, ‘PHP’]
[‘C’, ‘Java’, ‘PHP’]
[‘PHP’, ‘Python’, ‘Java’, ‘C++’, ‘C’]
Memorise: list[::-1] reverses any list — appears in almost every board paper.

Section 4 · Traversal · ⭐⭐

🔄 Traversing a List Using Loops

# Method 1 — for loop (element-wise)
mylist = [“C”, “C++”, “Java”, “Python”, “PHP”]
for item in mylist:
print(item)
# Method 2 — for loop with index
for i in range(len(mylist)):
print(i, “-“, mylist[i])
# Method 3 — while loop
i = 0
while i < len(mylist):
print(mylist[i])
i += 1
💡 Use for i in range(len(list)) when you need both index and value.

Section 5 · Built-in Functions/Methods · ⭐⭐⭐

🛠️ Built-in Functions and Methods on Lists

len() and list()

mylist = [“C”, “C++”, “Java”, “Python”, “PHP”]
print(len(mylist)) # 5

print(list(“Python”)) # string to list
print(list((1, 2, 3))) # tuple to list

5
[‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’]
[1, 2, 3]

append() and extend()

append(x) adds a single item. extend(seq) adds each element separately.

mylist = [“C”, “C++”, “Java”]
mylist.append(“Python”)
mylist.append([“PHP”, “Go”]) # adds ONE item — nested list!
print(mylist)

mylist2 = [“C”, “C++”, “Java”]
mylist2.extend([“Python”, “PHP”])
print(mylist2)

[‘C’, ‘C++’, ‘Java’, ‘Python’, [‘PHP’, ‘Go’]]
[‘C’, ‘C++’, ‘Java’, ‘Python’, ‘PHP’]
⚠️ append() always adds exactly ONE item. extend() unpacks and adds each element individually.

insert()

mylist = [“C”, “C++”, “Java”, “Python”, “PHP”]
mylist.insert(2, “Rust”)
print(mylist)
[‘C’, ‘C++’, ‘Rust’, ‘Java’, ‘Python’, ‘PHP’]

count() and index()

nums = [10, 20, 10, 30, 10, 40]
print(nums.count(10)) # 3
print(nums.index(30)) # 3 — first index found
3
3

remove() and pop()

remove(x) deletes by value. pop(i) deletes by index and returns it.

mylist = [“C”, “C++”, “Java”, “Python”, “PHP”]
mylist.remove(“C++”)
print(mylist)

removed = mylist.pop(1)
print(removed)
print(mylist)

[‘C’, ‘Java’, ‘Python’, ‘PHP’]
Java
[‘C’, ‘Python’, ‘PHP’]

reverse(), sort() and sorted()

nums = [45, 12, 89, 23, 56]
nums.sort() # changes nums itself
print(nums)

nums2 = [45, 12, 89]
print(sorted(nums2)) # NEW list returned
print(nums2) # original unchanged!

[12, 23, 45, 56, 89]
[12, 45, 89]
[45, 12, 89]
⚠️ Exam Alert: sort() changes the original list and returns None. sorted(list) returns a NEW list, original untouched.

min(), max() and sum()

nums = [45, 12, 89, 23, 56]
print(min(nums))
print(max(nums))
print(sum(nums))
print(sum(nums) / len(nums)) # mean
12
89
225
45.0

📋 Complete Summary Table

MethodWhat it DoesChanges Original?
len(list)Returns number of elementsNo
list(seq)Converts a sequence into a listNo
append(x)Adds one item at the endYes
extend(seq)Adds each element of seqYes
insert(i, x)Inserts x at index iYes
count(x)Counts occurrences of xNo
index(x)Index of first occurrence of xNo
remove(x)Removes first occurrence of xYes
pop(i)Removes & returns item at index iYes
reverse()Reverses list in placeYes
sort()Sorts in place; returns NoneYes
sorted(list)Returns a NEW sorted listNo
min(list)Smallest elementNo
max(list)Largest elementNo
sum(list)Sum of numeric elementsNo

Section 6 · Nested Lists · ⭐⭐

🧩 Nested Lists

A nested list is a list inside another list — useful for tables, matrices, or grouped records.

student = [“Amit”, 16, [78, 85, 92]]
matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

print(student[2]) # [78, 85, 92]
print(student[2][1]) # 85
print(matrix[1][2]) # 6

for row in matrix:
for value in row:
print(value, end=” “)
print()

1 2 3
4 5 6
7 8 9
💡 Access nested elements with double indexing: matrix[row][col].

Section 7 · Suggested Programs · ⭐⭐⭐

💻 Common Programs for CBSE Practicals & Board Exams

Program 1 — Maximum, Minimum and Mean of a List

numbers = [23, 45, 12, 89, 34, 67]

maximum = max(numbers)
minimum = min(numbers)
mean = sum(numbers) / len(numbers)

print(“Maximum:”, maximum)
print(“Minimum:”, minimum)
print(“Mean:”, mean)

Without using built-in functions (common exam variant):

numbers = [23, 45, 12, 89, 34, 67]
maximum = numbers[0]
minimum = numbers[0]
total = 0

for n in numbers:
if n > maximum:
maximum = n
if n < minimum:
minimum = n
total += n

mean = total / len(numbers)
print(“Maximum:”, maximum, ” Minimum:”, minimum, ” Mean:”, mean)

Program 2 — Linear Search on a List of Numbers

numbers = [23, 45, 12, 89, 34, 67]
search_value = int(input(“Enter number to search: “))
found = False

for i in range(len(numbers)):
if numbers[i] == search_value:
print(“Found at index:”, i)
found = True
break

if not found:
print(“Value not found in the list”)

Program 3 — Counting Frequency of Elements in a List

numbers = [10, 20, 10, 30, 20, 10, 40]
freq = {}

for n in numbers:
if n in freq:
freq[n] += 1
else:
freq[n] = 1

for key, value in freq.items():
print(key, “occurs”, value, “time(s)”)

10 occurs 3 time(s)
20 occurs 2 time(s)
30 occurs 1 time(s)
40 occurs 1 time(s)
💡 For a single value, numbers.count(10) gives its frequency in one line.

Frequently Asked Questions

Is a list mutable or immutable in Python?
A list is mutable — its elements can be changed after creation, unlike a string.

Difference between append() and extend()?
append(x) adds exactly one item (even a whole list, as a nested element). extend(seq) adds each element individually.

Difference between remove() and pop()?
remove(x) deletes by value. pop(i) deletes by index and returns the removed value.

Difference between sort() and sorted()?
sort() sorts in place and returns None. sorted(list) returns a new sorted list, original unchanged.

What does list[::-1] do?
It reverses the list using a step of -1.

How to access an element inside a nested list?
Use double indexing: list[outer_index][inner_index].


Quick Practice Links

📝 List MCQs Class 11  |  Python Compiler  |  📂 Practical File  |  📖 All Class 11 Notes

Explore More Class 11 CS Notes

📄 Python String  |  📌 Python Tuple  |  📖 Python Dictionary  |  🔧 Python Functions

Found an error or a missing example? Drop a comment below — we fix issues quickly!

Jitendra Singh
✔ Verified Educator

Jitendra Singh

Founder of CBSEPython.in

I help CBSE Class 9–12 students learn Python, Information Technology, Artificial Intelligence and Computer Science through easy notes, quizzes, MCQs and sample papers.

Read More About Me →

Leave a Comment