0
Whats a different between append and insert in python
3 Réponses
+ 3
its simple
1.append adds elements at end of a list
2.insert uses index to insert elements in a
list
a=[1,2,3]
a.append(7)
print a #[1,2,3,7]
a.insert(1,10) #(index,value)
print a #[1,10,2,3,7]
and
a.insert(len(a),x) is same as a.append(x)
+ 30
What programming language?
+ 1
its so simple append adds element at the end of the list whereas insert adds the element in particular position which you specify👊😊