“Pop vs Usuń Python” Kod odpowiedzi

Lista Python Pop vs Usuń

>>> a = [9, 8, 7, 6]
>>> del a[1]
>>> a
[9, 7, 6]
Glorious Gorilla

Pop vs Usuń Python

"diffrence between 'remove()','pop()' and 'del list[]' functions"
# list.remove()
*It only removes the object it does not bother about indexing.
# list.pop()
* pop removes specific index,also it returns object back.
# del list[]
*it can remove the index and object in it also entire list can be deleted.
#definition of each of the list function concludes some diffrences in them.
*'remove' deals with object while 'pop' and 'del' do focus on index.
*'pop' could return the deleted value of index while 'del' can not.
#These functions are aplicable at list not sequence like tuple.
Gr@Y_orphan_ViLL@in##

Lista Python Pop vs Usuń

>>> a = [4, 3, 5]
>>> a.pop(1)
3
>>> a
[4, 5]
Glorious Gorilla

Lista Python Pop vs Usuń

>>> a = [0, 2, 3, 2]
>>> a.remove(2)
>>> a
[0, 3, 2]
Glorious Gorilla

Odpowiedzi podobne do “Pop vs Usuń Python”

Pytania podobne do “Pop vs Usuń Python”

Więcej pokrewnych odpowiedzi na “Pop vs Usuń Python” w Python

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu