Python Basics | More Lists | Add, Change, Remove

preview_player
Показать описание
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)

print(fruits)

print(fruits)

print(fruits)

print(fruits)
Рекомендации по теме
welcome to shbcf.ru