Daftar -1 Python

l = [1,2,5,9,7,4,5]

# what are you referring to?
# 1) l[-1] is the last element of list
print(l[-1])
>>> 5

# 2) l[:-1] returns all the elements of the list but the last one
print(l[:-1])
>>> [1,2,5,9,7,4] 
wolf-like_hunter