Python List() function
Published February 16, 2022Lists are used in Python to store multiple items in a single variable. Lists are one of the four built-in data types for holding data collections. To create a list object, you’ll need to use the list() function. The list() function generates a changeable and ordered list of items from the collection.
Let's have a look at the syntax for list().
Syntax
The list () function has the following simple syntax.
list(iterable) |
where the iterable, is the iterator object or the collection that need to be stored in a list
Example
In this example we, are going to create a list of various programming languages
Programming_Languages = ('Python', 'PHP', 'JavaScript', 'R'); |
Output
If you execute the above code, you will see the following
List of Programming Language : ('Python', 'PHP', 'JavaScript', 'R') |
Article Contributed By :
|
|
|
|
262 Views |