0% found this document useful (0 votes)
37 views1 page

Class 12 CS Python Lists Notes

A list is a mutable, ordered collection in Python that can store multiple values and allows for duplicate entries. Key characteristics include being index-based and able to hold different data types, with various methods available for manipulation such as append, insert, and sort. Lists differ from tuples in that they are mutable while tuples are immutable.

Uploaded by

ssadevds560
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views1 page

Class 12 CS Python Lists Notes

A list is a mutable, ordered collection in Python that can store multiple values and allows for duplicate entries. Key characteristics include being index-based and able to hold different data types, with various methods available for manipulation such as append, insert, and sort. Lists differ from tuples in that they are mutable while tuples are immutable.

Uploaded by

ssadevds560
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Class 12 Computer Science – Python Lists (Quick Notes)

What is a List?
A list is a mutable, ordered collection used to store multiple values in a single variable.

Characteristics
1 Ordered (index-based)
2 Mutable (changeable)
3 Allows duplicate values
4 Can store different data types
Accessing Elements
Use index positions starting from 0. Negative index starts from -1 (last element).

Slicing
Syntax: list[start : stop : step]

Important List Methods


1 append(x): Adds x at the end
2 insert(i, x): Inserts x at index i
3 extend(list): Adds elements of another list
4 pop(): Removes last element
5 remove(x): Removes value x
6 sort(): Sorts the list
7 reverse(): Reverses the list
List vs Tuple
1 List is mutable, Tuple is immutable
2 List uses [ ], Tuple uses ( )
Common Board Questions
1 Define list and write its features.
2 Difference between append() and extend().
3 Write a program to find largest element in a list.

You might also like