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

Exp4 Quest

This document outlines Experiment No. 4A, which focuses on understanding various operations on Lists and Tuples in Python using built-in functions. It explains the characteristics of Lists (mutable) and Tuples (immutable) and details operations such as adding, removing, and manipulating elements. The document also includes specific built-in functions like len(), append(), insert(), and others for performing these operations.

Uploaded by

bhaktilambate
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)
6 views1 page

Exp4 Quest

This document outlines Experiment No. 4A, which focuses on understanding various operations on Lists and Tuples in Python using built-in functions. It explains the characteristics of Lists (mutable) and Tuples (immutable) and details operations such as adding, removing, and manipulating elements. The document also includes specific built-in functions like len(), append(), insert(), and others for performing these operations.

Uploaded by

bhaktilambate
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
You are on page 1/ 1

Experiment No.

4A
Aim: Write programs to understand Different List and Tuple operations using Built-in functions
Software: Python

Theory : A List is a mutable, ordered collection of elements in Python whose Elements can be of
different data types. They are Defined using square brackets []. List Supports dynamic resizing,
adding, and removing elements.
A Tuple is an immutable, ordered collection of elements in Python whose Elements can be of
different data types. They are Defined using parentheses (). Once a tuple is created, its elements
cannot be added, removed, or modified
Different Operations on List and Tuple using Built-in Functions:
1)Length of List or Tuple (len()): len(my_list) returns the number of elements in the list or tuple.
2)Adding Elements (append()): my_list.append(element) adds the specified element to the end of
the list.
3)Inserting Elements (insert()):my_list.insert(index, element) inserts the element at the specified
index in the list.
4)Removing Elements (remove()): my_list.remove(element) removes the first occurrence of the
specified element from the list.
5)Popping Elements (pop()): my_list.pop(index) removes and returns the element at the specified
index. If no index, removes the last element.
6)Index of Element (index()):my_list.index(element) returns the index of the first occurrence of
the specified element in the list.
7)Count Occurrences (count()): my_list.count(element) returns the number of occurrences of the
specified element in the list.
8)Sorting (sort()): my_list.sort() sorts the elements of the list in ascending order. Use
reverse=True for descending order.
9)Reversing Elements (reverse()): my_list.reverse() reverses the order of elements in the list.
10)Concatenation (+): new_list = list1 + list2 concatenates two lists or tuples.
11)Repetition (*): new_list = my_list * 3 repeats the elements of the list or tuple three times.

You might also like