Python

List methods (append, extend, insert, pop, remove)

Në shqip: Metodat e listave

ShpjegimiSQ

Listat kanë metoda të gatshme: append() shton në fund, extend() shton disa, insert() shton në një pozicion, pop() heq dhe kthen, remove() heq sipas vlerës, index() gjen pozicionin.

EnglishEN

Lists have built-in methods: append() adds to the end, extend() adds several, insert() adds at a position, pop() removes and returns, remove() removes by value, index() finds the position.

Si ta mendosh

Si radha në dyqan: dikush hyn në fund, dikush del, dikush futet në mes.

Lexoje në anglisht

Like a queue in a shop: someone joins at the back, someone leaves, someone cuts in.

Shembull kodipython

v = [3, 1]
v.append(5); v.extend([7, 9]); v.insert(0, 0)
print(v.pop(), v)   # 9 [0, 3, 1, 5, 7]

Terma të lidhur