Question #125   Submitted by Answiki on 08/27/2020 at 01:35:44 PM UTC

How to create a list with given values in Python?

Answer   Submitted by Answiki on 08/27/2020 at 01:38:52 PM UTC

Here is how to create a list in Python with provided values:

# Create list of integers
my_list = [1, 2, 3, 4, 5]

Note that data types can be mixed in Pyhton lists:

# List with mixed data types
my_list = ["Hello", 123; 3.1415]

2 events in history
Answer by Answiki on 08/27/2020 at 01:38:52 PM

Here is how to create a list in Python with provided values:

# Create list of integers
my_list = [1, 2, 3, 4, 5]

Note that data types can be mixed in Pyhton lists:

# List with mixed data types
my_list = ["Hello", 123; 3.1415]

Question by Answiki 08/27/2020 at 01:35:44 PM
How to create a list with given values in Python?
# ID Query URL Count

Icons proudly provided by Friconix.