A

Admin • 832.27K Points
Coach

Q. Which method adds an element at the end of a list?

Code:
l = [1, 2, 3]
  • (A) l.add(4)
  • (B) l.append(4)
  • (C) l.insert(4)
  • (D) l.extend(4)
  • Correct Answer - Option(B)
  • Views: 20
  • Filed under category Python
  • Hashtags:

Explanation by: Admin

`append()` adds an element at the end of the list.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.