1. behind additional list elements
= the User [] the while True: name = the INPUT ( " Enter name: " ) # append elements behind the list user.append (name) Print (the User)
2. Insert elements in the list
User = [ ' John Doe ' , ' John Doe ' , ' King fog ' ] # in front of "1" inserted position "WDC" (insert elements at the specified index) user.insert (1, ' WDC ' ) Print ( user)
3. Delete the elements in the list
User = [ ' John Doe ' , ' John Doe ' , ' King fog ' ] # delete elements in the list specified field user.remove ( ' John Doe ' ) Print (User)
user = [ 'John Doe', 'John Doe', 'King fog']
# remove elements specified index in the list
user.pop (. 1)
Print (User)
user = [ 'Joe Smith', 'John Doe', 'king of fog']
# default Removes the last element
user.pop ()
Print (the User)
4. Clear List
User = [ ' John Doe ' , ' John Doe ' , ' King fog ' ] # Clear List user.clear () Print (User)