Search

# Python lists and lists function

Hello Everyone welcome to my Python block series. Previous block I discussed Python variables with examples. Here I will tell you about Python list and list functions.

###### Python lists:

There are four data types in Python programming language.

1. List
2. Touple
3. Dictionary
4. Set

Here I will tell you about the list. The list is a collection that is ordered and changeable. In Python, lists are written with square brackets. Let’s take examples.

This is an example of a list here Certification, training, cybersecurity, web designing, and services are elements. The following output is:

Let’s take another example
Here this is a simple example of a list data type. The output of the following input is let a take some big examples. This example can explain all the basics of the list.
The output of the following input is:
#Guys if are new to Python then please read carefully with mind concentration

List function in Python:

Here I discuss some important functions in the list.

1. sort function: This function is used for sorting purposes ( number sorting). The output of the following program is :

Let’s take 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 uses for determining the length. See the example
This len function determines 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 how to determine the 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 the minimum number. In Python, we determine easily by using a particular function.

5. Append function: The append function is used for adding numbers to a list. The question is how? Again let’s take an example
number.append(7) function add the 7 number in a list at the end. see the output.

Let’s take a task. Take an empty list and add 8,45,5 numbers. (This operation can also perform by the append function ) see this.
This program performs a particular task. see the output.

If I want to insert a number in a list at a particular location? What can I do about that ?? see this.
See the output guys. 98 number is inserted at 1 index location.

6. Remove function: By name, it’s clear what the remove function does. Remove function remove the particular element in a list. how? Let’s take an example.

See the output guys :
In the next blog, we learn about Tuple in Python.