List Learning----------list:append tail insertion----------
name_list = ["alex","tony","eirc"]name_list.append(‘seven‘)name_list.append(‘moon‘)print(name_list)
----------List:insert Insert----------by position
name_list = ["alex","tony","eirc"]name_list.insert(2,‘pepole‘)print(name_list)
----------list:extend String Extension----------
name_list = ["alex","tony","eirc"]temp = [11,22,33,44]name_list.extend(temp)print(name_list)
----------the number of occurrences of the List:count element----------
name_list = ["alex","tony","eirc"]print(name_list.count(‘tony‘))
----------List:index Find the index position of an element----------
name_list = ["alex","tony","eirc"]print(name_list.index(‘alex‘))
----------List:p op removes the last element from the original list and assigns it to another variable----------
name_list = ["alex","tony","eirc"]x = name_list.pop()print(name_list)print(x)
----------List:remove Remove an element----------
name_list = ["alex","tony","eirc"]name_list.remove(‘alex‘)print(name_list)
----------List: element Delete, deletes the specified index location----------
name_list = ["alex","tony","eirc"]del name_list[1:3]print(name_list)
Python notes Two