python how to add a string to the beginning of a list

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

showing results for - "python how to add a string to the beginning of a list"
Henri
15 May 2020
1listexample['exampleone', 'examplethree']
2listexample.insert(0, 'exampletwo')
3print(listexample)
4#prints ['exampletwo', 'exampleone', '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.