How to Make a New List in Python


In this example, we will learn how to make a new list using the list() constructor in Python.

Source Code

list1 = list(('p', 'y', 't', 'h', 'o', 'n'))
print(list1)

list2 = list('python')
print(list2)

Output:

['p', 'y', 't', 'h', 'o', 'n']
['p', 'y', 't', 'h', 'o', 'n']
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Advertisement