How can you add an item to the end of a list in Python?

QuestionsQuestions8 SkillsProPython Data StructuresAug, 20 2025
0122

You can add an item to the end of a list in Python using the append() method. Here’s an example:

my_list = [1, 2, 3]
my_list.append(4)
print(my_list)  # Output: [1, 2, 3, 4]

In this example, the number 4 is added to the end of my_list.

0 Comments

no data
Be the first to share your comment!