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

List in Python

The document defines a list as a mutable sequence of values, where each value is called an item. It explains indexing as accessing elements by their position, with negative indexing allowing access from the end of the list. Additionally, it differentiates between indexing and slicing, provides a program to add elements to a list, and describes the max() and min() functions for finding the largest and smallest elements in a list.

Uploaded by

ronika2819
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)
13 views1 page

List in Python

The document defines a list as a mutable sequence of values, where each value is called an item. It explains indexing as accessing elements by their position, with negative indexing allowing access from the end of the list. Additionally, it differentiates between indexing and slicing, provides a program to add elements to a list, and describes the max() and min() functions for finding the largest and smallest elements in a list.

Uploaded by

ronika2819
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

Answer the following questions:

1. Define the term list .

A list is a sequence of multiple values stored together in a variable in a sequence. In a list, each element
or value is called an item. List is mutable, which means the items in a list can be modified by assigning
new values when needed .

2.What is indexing ?

indexing refers to the process of accessing a specific element in a sequence of list , using its
position or index number.The index of elements of a list starts from 0 to the end of the list ; which
means if a list contains 10 elements then its index (it is always an integer number) is from 0 to 9.

3.What do you mean by the term negative indexing ?

Negative indexing means to access elements in a list from the end instead of the beginning the
index of the last elements of the list will be -1 and the index of -2 refers to the second last element.

4.Differentiate between indexing and slicing .

Indexinf refers to accessing the elements of the list which starts from 0 whereas slicing is a way to get
specific parts of a list by using start, end, and step values. In python list slicing is done by using the
Slicing operator(:).

5. Write a program to add element (12,2,34,65) to the list =[13,25,41,63,82]

list=[13,25,41,63,82]

list.extend([12,2,34,65])

print(list)

6. What is the purpose of using max(list) and min(list) functions

max(list): Returns the largest element from the given list

min(list): Returns the smallest element from the given list Scratch Your Brain.

You might also like