RE: How you add an element to the list. What syntax will add the string, “Porsche”, to the list?

Answered
I have created a list in Python like this:

  mylist = []

I want to add an element to the list. What syntax will add the string, “Porsche”, to the list?

sid Asked on September 15, 2017 in Python.
Add Comment
3 Answers
Best answer

Answer :   mylist.append(“Porsche”)

Explanation:

The method append() appends a passed obj into the existing list.

list.append(obj)
Answered on September 17, 2017.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.