print('Hello world!')
# Create an empty list
my_list = []
# Add elements to the list
my_list.append(1)
my_list.append(2)
my_list.append(3)
# Print the list
print("Initial list:", my_list)
# Access elements in the list
print("Element at index 0:", my_list[0])
print("Element at index 2:", my_list[2])
# Update elements in the list
my_list[1] = 4
print("Updated list:", my_list)
# Remove elements from the list
my_list.remove(3)
print("List after removing 3:", my_list)
# Find the length of the list
list_length = len(my_list)
print("Length of the list:", list_length)
# Check if an element is in the list
if 2 in my_list:
print("2 is in the list")
# Sort the list in ascending order
my_list.sort()
print("Sorted list:", my_list)
# Reverse the list
my_list.reverse()
print("Reversed list:", my_list)
# Concatenate lists
other_list = [5, 6, 7]
combined_list = my_list + other_list
print("Combined list:", combined_list)
# Slice the list
sliced_list = combined_list[1:4]
print("Sliced list:", sliced_list)
To embed this project on your website, copy the following code and paste it into your website's HTML: