How to use insert() Function in Python with Example?

The `insert()` function in Python is used to insert an element at a specific position in a list. The syntax for the `insert()` function is:

list.insert(index, element)

index: The position where the element has to be inserted.
element: The element that needs to be inserted into the list.

Example:

# Create a list
my_list = [1, 2, 4, 5]
# Insert an element at the 2nd index (3rd position)
my_list.insert(2, 3)
print(my_list)

Output:

[1, 2, 3, 4, 5]

In this example, the number `3` is inserted at index `2`, shifting the elements `4` and `5` to the right. The list is updated accordingly.