which function is used to add new elements in a list?
I)append()
2)pop()
3)add()
4) none of the above
Answers
Answered by
3
Answer:
3)add()
Explanation:
The function add() is used to add new elements in a list.
Answered by
0
Answer: 1) append()
Explanation:
# 'pop' method is used to REMOVE an element of the list
# 'add' isn't even a method that can be used on a list. So, for example, if you try to use 'add' saying,
Input:
courses1 = ['Art', 'Music', 'Dance']
courses2 = ['History', 'Psychology']
courses1.add(courses2)
print(courses1)
Output:
you will end up with an error that says,
AttributeError: 'list' object has no attribute 'add'
Hope this was helpful because the other answer given is wrong.
I am giving you guys this answer after trying out the program myself. You too can check this in python if you want to.
Similar questions