python append in specific position

Solutions on MaxInterview for python append in specific position 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 append in specific position"
Brittany
03 Jan 2019
1# --> list.insert(position, element) <--
2
3# List of string 
4list1 = ['Hi' ,  'hello', 'at', 'this', 'there', 'from']
5
6# Add an element at 3rd position in the list
7list1.insert(3, 'why')
8#-> ['Hi', 'hello', 'at', 'why', 'this', 'there', 'from']