Javatpoint Logo
Javatpoint Logo

Python list() Function

The python list() creates a list in python.

Signature

Parameters

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

Return

It returns a list.

Python list() Function Example 1

The below example create a list from sequence: string, tuple and list.

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.

Python list() Function Example 2

The below example create list from collection: set and dictionary.

Output:

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

Next TopicPython Functions





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA