Computer ScienceClass 11Lists

Understanding Lists in Class 11 Computer Science NCERT

By ConceptScroll Team · Published on 17 July 2026 · 4 min read

Lists are fundamental data structures in Class 11 NCERT Computer Science. They store ordered collections of items and allow easy access, modification, and manipulation using indexing and operations. This guide covers everything you need to know about lists for your exams.

What Are Lists in Class 11 Computer Science?

In Class 11 NCERT Computer Science, a list is a collection of items arranged in a specific order. Lists can hold elements of different data types like integers, strings, or even other lists. They are mutable, meaning you can change their content after creation.

Key points about lists:

  • Ordered collection: Elements have a defined sequence.
  • Mutable: You can add, remove, or modify elements.
  • Can contain duplicates.
  • Created using square brackets [].

Example:

``python myList = [10, 'apple', 3.14, True] ``

Lists are essential for storing and managing data efficiently in programming and form a core part of your NCERT syllabus.

Accessing Elements in a List Using Indexing

Accessing elements in a list is done through indexing. The first element is at index 0, the second at index 1, and so on. Python also supports negative indexing, where -1 refers to the last element, -2 to the second last, etc.

How to access elements:

  • Positive indexing: list1[0] gives the first element.
  • Negative indexing: list1[-1] gives the last element.

Example:

``python list1 = [12, 32, 65, 26, 80, 10] print(list1[2]) # Outputs 65 print(list1[-1]) # Outputs 10 ``

Important:

  • Accessing an index outside the list length causes an IndexError.
  • Use len(list1) to get the number of elements.

This indexing system allows flexible reading and modification of list elements.

Want to test yourself on Lists? Try our free quiz →

Modifying Lists: Append, Extend, and Deletion

Lists can be changed after creation. Common operations include adding and removing elements.

Adding elements:

  • append(element): Adds a single element at the end.
  • extend(iterable): Adds all elements from another list or iterable.

Example:

```python myList = [10, 20, 30, 40] myList.append([50, 60]) print(myList) # [10, 20, 30, 40, [50, 60]]

myList.extend([80, 90]) print(myList) # [10, 20, 30, 40, [50, 60], 80, 90] ```

Deleting elements:

  • Use del statement with indices or slices.

Example:

``python del myList[3:] # Deletes elements from index 3 to end print(myList) ``

These methods help manage list contents dynamically in your programs.

Slicing Lists for Subsets and Steps

Slicing extracts parts of a list using the syntax:

``python list[start:end:step] ``

  • start is the index to begin (inclusive).
  • end is the index to stop (exclusive).
  • step is how many elements to skip.

Example:

``python list1 = [1,2,3,4,5,6,7,8,9,10] print(list1[0:5]) # [1,2,3,4,5] print(list1[::-2]) # [10,8,6,4,2] ``

Slicing is useful for:

  • Getting sublists
  • Reversing lists
  • Skipping elements

Remember, omitting start or end defaults to the beginning or end of the list respectively.

Sorting Lists: sort() vs sorted()

Sorting arranges list elements in ascending or descending order.

Two ways to sort:

MethodDescriptionModifies Original List?Returns Sorted List?
list.sort()Sorts list in placeYesNo
sorted(list)Returns a new sorted listNoYes

Example:

```python list1 = [12, 32, 65, 26, 80, 10] list1.sort() print(list1) # [10, 12, 26, 32, 65, 80]

list2 = [12, 32, 65, 26, 80, 10] sorted_list = sorted(list2) print(list2) # Original unchanged print(sorted_list) # Sorted copy ```

Use sort() when you want to change the original list and sorted() when you want a new sorted list without altering the original.

Iterating Through Lists with Loops

Loops let you process each element in a list.

Using for loop with index:

``python myList = [1,2,3,4,5,6,7,8,9,10] for i in range(len(myList)): if i % 2 == 0: print(myList[i]) ``

Output: `` 1 3 5 7 9 ``

This prints elements at even indices.

Using for loop directly on elements:

``python for element in myList: print(element) ``

Loops help perform operations like filtering, modifying, or displaying list elements efficiently.

Frequently asked questions

What is the difference between append() and extend() in lists?

append() adds a single element to the end, while extend() adds each element from an iterable individually.

How does negative indexing work in lists?

Negative indexing starts from the end: -1 is last element, -2 second last, and so on.

What happens if I access an index outside the list range?

Accessing an invalid index causes an IndexError, so always check list length first.

Does sorted() change the original list?

No, sorted() returns a new sorted list without modifying the original list.

How can I delete multiple elements from a list?

Use del with slicing syntax, e.g., del list1[2:5] removes elements from index 2 to 4.

Ready to ace this chapter?

Get the full Lists chapter — interactive notes, diagrams, worked solutions, polls and a free practice quiz — in the ConceptScroll app.

Open in ConceptScroll →

Study smarter with ConceptScroll

Daily NCERT-aligned reels, AI doubt solving and chapter quizzes — all free.

Start learning free
#append#class11#computer science#extend#indexing#lists#ncert#python#slicing#sorting

Continue reading