Created
March 23, 2023 16:59
-
-
Save Sachin-crypto/5e6cbfa4cd9db71f7b145bd33df961fe to your computer and use it in GitHub Desktop.
A simple demonstration of list insert()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# List of names | |
friends = ['Sachin', 'Rishu', 'Yashwant'] | |
# Printing the original list | |
print('Original List:', friends) | |
# Inserting an element | |
friends.insert(1, 'Abhishek') | |
# Printing the updated list | |
print('New List: ', friends) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment