The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Ask
Anybody can ask a question
Answer
Anybody can answer
Vote
The best answers are voted up and moderated by our team

How do we add new elements in the list at a particular position in the list?

How do we add new elements in the list at a particular position in the list?

0
Votes
1
Answer
1 Answer

365 Team
0
Votes

Hi Sayed!
 
Great to have you in the course and thanks for reaching out!
 
You can use the .insert() method to do that. The syntax structure to follow is list_name.insert(index, element). I.e., in the list called list_name, this will insert element in the given index, shifting the elements to the right.
 
Hope this helps.
Best,
Martin

×
EXTENDED SALE
Learn Data Science this Summer!
Get 50% OFF