list of lists python code example
Example 1: list of lists python
listOfLists = [[1,2,3],['hello','world'],[True,False,None]]
Example 2: python list and list
a = ['apple', 'banana', 'pear']
b = ['fridge', 'stove', 'banana']
a & b == ['banana']
Example 3: 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 4: convert list to list of lists on every n elements python
n = 5
my_list_of_lists = [my_list[i:i + n] for i in range(0, len(my_list), n)]