filmov
tv
Understanding List Methods in Python #python #pythontutorial #pythonprogramming

Показать описание
Python Tutorial: Useful List Methods You Should Know
# Applying methods to the 'burger' list
burger = ["🍔", "🍔", "🍟"]
print("Your original order:", burger)
# .append(🍔)
print(".append(🍔) -", burger)
# Reset list
burger = ["🍔", "🍔", "🍟"]
# .clear()
print(".clear() -", burger)
# Reset list
burger = ["🍔", "🍔", "🍟"]
# .count(🍟)
# .copy()
print(".copy() -", burger_copy)
# .index(🍟)
print(".index(🍟) -", index_fries)
# .insert(1, 🥤)
print(".insert(1, 🥤) -", burger)
# Reset list
burger = ["🍔", "🍔", "🍟"]
# .pop(2)
print(".pop(2) -", burger)
# Reset list
burger = ["🍔", "🍔", "🍟"]
# .remove(🍔)
print(".remove(🍔) -", burger)
# Reset list
burger = ["🍔", "🍔", "🍟"]
# .reverse()
print(".reverse() -", burger)
# Applying methods to the 'burger' list
burger = ["🍔", "🍔", "🍟"]
print("Your original order:", burger)
# .append(🍔)
print(".append(🍔) -", burger)
# Reset list
burger = ["🍔", "🍔", "🍟"]
# .clear()
print(".clear() -", burger)
# Reset list
burger = ["🍔", "🍔", "🍟"]
# .count(🍟)
# .copy()
print(".copy() -", burger_copy)
# .index(🍟)
print(".index(🍟) -", index_fries)
# .insert(1, 🥤)
print(".insert(1, 🥤) -", burger)
# Reset list
burger = ["🍔", "🍔", "🍟"]
# .pop(2)
print(".pop(2) -", burger)
# Reset list
burger = ["🍔", "🍔", "🍟"]
# .remove(🍔)
print(".remove(🍔) -", burger)
# Reset list
burger = ["🍔", "🍔", "🍟"]
# .reverse()
print(".reverse() -", burger)