Robotics & Artificial Intelligence
Create a list and demonstrate the use of 'insert' function.
Python List Manipulation
1 Like
Answer
city_list = ["Delhi", "Mumbai", "Chennai"]
city_list.insert(1, "Kolkata")
print(city_list)
Output
['Delhi', 'Kolkata', 'Mumbai', 'Chennai']
The insert() function is used to add an element at a specified index position in the list.
Answered By
2 Likes
Related Questions
How are machine intelligence and human intelligence inspired by each other?
How can we avoid unauthorised access of hardware or software?
Write a Python program to demonstrate the use of repetition operator of a String.
What is the motivation behind the progress from robots to cobots? Write a comparison between robots and cobots.