Lists (append, sort, pop, slice, in, enumerate) - Python Tutorial for Beginners #8
9views
008:07
T
Taught by Celeste AI - AI Coding Coach
View on YouTubeDescription
Learn Python lists in this beginner-friendly tutorial! 📋
In this lesson, you will learn:
✅ Creating lists with square brackets
✅ Indexing and slicing to access elements
✅ Membership testing with the in keyword
✅ List methods: append, insert, remove, pop
✅ Sorting, reversing, and copying lists
✅ Mini Project: Grocery List Manager
🕐 Timestamps:
0:00 - Introduction
0:22 - List Basics Explained
0:46 - List Basics Demo
2:05 - List Methods Explained
2:29 - List Methods Demo
3:56 - Mini Project Explained
4:20 - Grocery List Demo
6:36 - Recap
7:11 - End
💻 Source Code: https://github.com/GoCelesteAI/python_lists
📚 Code from this lesson:
# List Basics
colors = ["red", "green", "blue"]
print(colors[0])
print(colors[1:4])
print("red" in colors)
# List Methods
fruits.append("cherry")
fruits.insert(1, "mango")
fruits.remove("banana")
last = fruits.pop()
nums.sort()
# Grocery List Manager
while True:
cmd = input("Command: ")
if cmd == "add":
items.append(item)
elif cmd == "show":
for i, item in enumerate(items, 1):
print(f" {i}. {item}")
🔗 Previous: Lesson 7 - Loops & Iteration
🔗 Next: Lesson 9 - Tuples & Sets
#Python #PythonTutorial #LearnPython #Programming #Lists #PythonLists
Tags: Python, Python tutorial, Python for beginners, learn Python, Python lists, list methods, append, sort, pop, slice, enumerate, in
keyword, indexing, grocery list, CelesteAI