index:

list1 = ['a','b','c','d']

list1.index('a')

return 0

append(): not works for string

spam.append('cat')

insert()

spam.insert(1,'chicken')

remove()

spam.remove('cat'),

if value not in the spam list , will call out the ValueError .

if there are multiple values in the list , will only remove the first one

sort()

spam.sort() or spam.sort(reverse = True)

sorting happens in ASCII-betical order
spam = ['a','z','A','Z']
spam.sort()
spam
['A','Z','a','z']
spam.sort(key = str.lower)
['A','a','Z','z']

results matching ""

    No results matching ""