Python lists and lists function

Hello Everyone welcome in my python block series .Previous block i discussed about python variables with examples . Here i will tell you about python list and list function .

Python lists :

There are four data type in python programming language . 1. List 2. Touple 3. Dictionary 4. Set

Here i will tell about list. List is a collection which is ordered and changeable . In python lists are written with square bracket. Lets take examples .

This is a example of list here Cetification , training , cybersecurity , webdesigning and services are elements . The following output is :

Lets take a another example

Here this is a simple example of list data type . The output of the following input is

lets a take some big example . This example can explain all the basic about list .

output of the following input is : #Guys if are new in python then please read carefully with mind concentration .

List function in python :

Here i discuss about some important functions in list .

1. sort function :

This function is used for sorting purpose ( number sorting )

The output of the following program is :

Lets take a one task . The task is 6,5,5,4,33,78,8 perform sorting and reverse the string .

2. Reverse function : This function can reverse the string .

The output of the following program is :

3. Len function

Len function use for determining the length . See the example

This len function determine the length of the numbers.See the output guys.

4. Max and Min function

This function is used for determining the maximum number and the minimum number .

In this program we see that how to determine length , maximum and minimum number in a list. See the output guys .

Here 6 is the length of the list and 88 is the maximum number and 2 is a minimum number . In python we determine easily by using particular function.

5. Append function

Append function is used for add number in a list . The question is how ? Again lets take a example

numbers.append(7) function add the 7 number in a list at the end . see the output .

Lets take a task . Take a empty list and add 8,45,5 number . (This operation can also perform by append function ) see this .

This program performs the particular task . see the output .

If i want to insert a number in a list at a particular location ? What can i do for that ?? see this ..

See the output guys . 98 number is insert at 1 index location .

6. Remove function

By name it’s clear what remove function do ? Remove function remove the particular element in a list . how ? Lets take a example .

See the output guys :

In next blog we learn about Tuple in python .

Leave a Comment

Your email address will not be published. Required fields are marked *