what does list() do in python code example
Example 1: how to use a list in python
my_list = []
my_list = [1, 2, 3]
my_list = [1, "Hello", 3.4]
Example 2: list in python
thislist = ["apple", "banana", "cherry"]
print(thislist[1])
Example 3: list in python
myfavouritefoods = ["Pizza", "burgers" , "chocolate"]
print(myfavouritefoods[1])
print(myfavouritefoods)
Example 4: list() python
print(list())
vowel_string = 'aeiou'
print(list(vowel_string))
vowel_tuple = ('a', 'e', 'i', 'o', 'u')
print(list(vowel_tuple))
vowel_list = ['a', 'e', 'i', 'o', 'u']
print(list(vowel_list))
Example 5: list in python
list = ['this is str', 12, 12.2, True]