LIST IN PYTHON

# Creating a list
fruits = ["apple", "banana", "cherry"]

# Accessing elements
print(fruits[0])  # Output: apple

# Adding elements
fruits.append("orange")

# Removing elements
fruits.remove("banana")

# Looping through a list
for fruit in fruits:
    print(fruit)
Python

Leave a Reply

Your email address will not be published. Required fields are marked *


error: Content is protected !!
Scroll to Top
MacroNepal
Verified by MonsterInsights