Use pop() to remove an element based on its index.

PHOTO EMBED

Tue Oct 25 2022 06:06:44 GMT+0000 (Coordinated Universal Time)

Saved by @L0uJ1rky45M #python

t = ['zero', 'one', 'two']
x = t.pop(1)
print(t)
# ['zero', 'two']
print(x) #pop() can return the element that was removed. 
# one
----
#If you don’t provide an index, it deletes and returns the last element.
t = ['zero', 'one', 'two']
x = t.pop()
print(t)
# ['zero', 'one']
print(x)
# two
content_copyCOPY

Useful if you know the index only. Otherwise, use remove()