1list.append(x) # append x to end of list
2list.extend(iterable) # append all elements of iterable to list
3list.insert(i, x) # insert x at index i
4list.remove(x) # remove first occurance of x from list
5list.pop([i]) # pop element at index i (defaults to end of list)
6list.clear() # delete all elements from the list
7list.index(x[, start[, end]]) # return index of element x
8list.count(x) # return number of occurances of x in list
9list.reverse() # reverse elements of list in-place (no return)
10list.sort(key=None, reverse=False) # sort list in-place
11list.copy() # return a shallow copy of the list
1list.append()
2list.clear()
3list.copy()
4list.count()
5list.extend()
6list.index()
7list.insert()
8list.pop()
9list.remove()
10list.reverse()
11list.append()
12list.clear()
13list.copy()
14list.count()
15list.extend()
16list.index()
17list.insert()
18list.pop()
19list.remove()
20list.reverse()
21list.sort()
22sorted(list)
1# Method Description
2# append() Adds an element at the end of the list
3# clear() Removes all the elements from the list
4# copy() Returns a copy of the list
5# count() Returns the number of elements with the specified value
6# extend() Add the elements of a list (or any iterable), to the end of the current list
7# index() Returns the index of the first element with the specified value
8# insert() Adds an element at the specified position
9# pop() Removes the element at the specified position
10# remove() Removes the first item with the specified value
11# reverse() Reverses the order of the list
12# sort() Sorts the list
13# Note: Python does not have built-in support for Arrays, but Py# Method Description
14# append() Adds an element at the end of the list
15# clear() Removes all the elements from the list
16# copy() Returns a copy of the list
17# count() Returns the number of elements with the specified value
18# extend() Add the elements of a list (or any iterable), to the end of the current list
19# index() Returns the index of the first element with the specified value
20# insert() Adds an element at the specified position
21# pop() Removes the element at the specified position
22# remove() Removes the first item with the specified value
23# reverse() Reverses the order of the list
24# sort() Sorts the list
1# empty list
2print(list())
3
4# vowel string
5vowel_string = 'aeiou'
6print(list(vowel_string))
7
8# vowel tuple
9vowel_tuple = ('a', 'e', 'i', 'o', 'u')
10print(list(vowel_tuple))
11
12# vowel list
13vowel_list = ['a', 'e', 'i', 'o', 'u']
14print(list(vowel_list))
1>>> fruits = ['orange', 'apple', 'pear', 'banana', 'kiwi', 'apple', 'banana']
2>>> fruits.count('apple')
32
4>>> fruits.count('tangerine')
50
6>>> fruits.index('banana')
73
8>>> fruits.index('banana', 4) # Find next banana starting a position 4
96
10>>> fruits.reverse()
11>>> fruits
12['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange']
13>>> fruits.append('grape')
14>>> fruits
15['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange', 'grape']
16>>> fruits.sort()
17>>> fruits
18['apple', 'apple', 'banana', 'banana', 'grape', 'kiwi', 'orange', 'pear']
19>>> fruits.pop()
20'pear'
21
1def all(iterable):
2 for element in iterable:
3 if not element:
4 return False
5 return True
6