Which Python command do we use to add a new element to a list a list1 addEnd 5 B list1 addLast 5 C list1 append 5 d list1 add 5?

To add a new element to a list we use which command?

To add a new element to a list we use which command?
A. list1.add[5]list1.add[5]
B. list1.append[5]list1.append[5]
C. list1.addLast[5]list1.addLast[5]
D. list1.addEnd[5]list1.addEnd[5]



Correct Answer is :B. list1.append[5]



ExplanationWe use the function append to add an element to the list.

Video liên quan

Bài mới nhất

Chủ Đề