Python Basics | More Lists | Add, Change, Remove

Опубликовано: 03 Июнь 2026
на канале: Functional Programming Tutor
16
1

In this video, I talk about adding, changing, and removing items in a list in Python. There is no problem to solve with this one as its more of showing some things that can be done with lists to introduce them. We will involve lists in a number of problems in videos going forward. As always the code is below for reference. Enjoy!


fruits = ['apple', 'banana', 'cherry', 'orange']
print(fruits)

fruits[0] = 'pineapple'
print(fruits)

fruits[1:2] = ['kiwi', 'mango', 'strawberry']
print(fruits)

fruits[1:4] = ['banana']
print(fruits)

fruits.append('mango')
print(fruits)

fruits.insert(2, 'kiwi')
print(fruits)

fruits.remove('mango')
print(fruits)

fruits.clear()
print(fruits)