What is the difference b/w append and insert | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

What is the difference b/w append and insert

.

12th Jul 2020, 7:16 AM
Amratesh Dixit
Amratesh Dixit - avatar
7 ответов
+ 5
Hope I understood your question clearly. Might be you're talking about append and insert in lists. Append always adds the item at the end of the list. And with insert, you can specify in which position you want to add that particular item to the list. For example:- s=[1,2,3,4] s.append(5) print(s) # prints [1,2,3,4,5] s.insert(6,0) # prints [6,1,2,3,4,5] As ~ swim ~ said please take some time to frame your question properly
12th Jul 2020, 7:31 AM
Arctic Fox
Arctic Fox - avatar
+ 4
Bagon Didn't answered in more detail. He might have done it in the course. The main question was what's the main difference between them. So, I a answered that only..
12th Jul 2020, 7:50 AM
Arctic Fox
Arctic Fox - avatar
+ 1
Ya i'm talking about python
12th Jul 2020, 7:27 AM
Amratesh Dixit
Amratesh Dixit - avatar
+ 1
Ohh , thanks BAGON
12th Jul 2020, 7:31 AM
Amratesh Dixit
Amratesh Dixit - avatar
+ 1
Thanks bro
12th Jul 2020, 7:32 AM
Amratesh Dixit
Amratesh Dixit - avatar
0
Ya it should be (0,"6")
12th Jul 2020, 7:37 AM
Amratesh Dixit
Amratesh Dixit - avatar
0
Append adds things to a list Insert inserts in the position you give as input
12th Jul 2020, 10:29 AM
P. Aamir
P. Aamir - avatar