python how to add a string to a list in the middle

Solutions on MaxInterview for python how to add a string to a list in the middle by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "python how to add a string to a list in the middle"
Mariangel
14 Apr 2019
1listexample['exampleone', 'examplethree']
2listexample.insert(1, 'exampletwo')
3print(listexample)
4#prints ['exampleone', 'exampletwo', 'examplethree']
5#Use the insert() method when you want to add data to the beginning or middle of a list. 
6#Take note that the index to add the new element is the first parameter of the method.