Languages
[Edit]
EN

Python - list() constructor

0 points
Created by:
Chronal
697

In this article, we would like to show you how to use list() constructor in Python.

Quick solution:

 

Practical examples

Edit

Example 1

Edit

In this example, we use list() constructor when creating a new list.

Output:

Example 2

Edit

Using list() constructor, we can also create list from string, tuple, dictionary or set like this:

Output:

Note:

The order of the elements in set will be random. 

Alternative titles

  1. Python - create list using constructor
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Python - list (popular problems)

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join