Python list() Function

Last Updated : 26 Aug 2026

The Python list() function is used to create a list in Python. It can convert other data types like strings, tuples, and sets into a list.

Syntax of list() Function

It has the following syntax:

Parameters

  • iterable (optional): An object that can be a sequence( string, tuple etc.) or collection( set, dictionary etc.) or iterator object.

Return Values

It returns a list.

Examples of list() Function

Here, we are going to discuss several examples that demonstrate the working of list() function.

Example 1: list() Function with Different Data Types

In this example, the list() function is used to create lists from different data types such as string, tuple, and existing list.

Python

Execute Now

Output:

[]
['a', 'b', 'c', 'd', 'e']
[1,2,3,4,5]
[1,2,3,4,5]

Explanation:

The above example creates a list from sequence: string, tuple and list.

Example 2: list() Function with Set and Dictionary

In this example, the list() function is used to convert a set and a dictionary into lists.

Python

Execute Now

Output:

['e', 'c', 'd', 'b', 'a']
['c', 'e', 'd', 'b', 'a']