elemen terakhir dalam daftar py
l = [1,2,3,4,5]
last = l[len(l)-1]
Wild Wildebeest
l = [1,2,3,4,5]
last = l[len(l)-1]
some_list = [1, 2, 3]
some_list[-1]
print(some_list)
#Output = 3
list1 = ['a','b','c']
print(list1[-1])
your_list = ["apple", "orange", "grapes"]
last_value = your_list[-1]
>>> some_list = [1, 2, 3]
>>> some_list[-1] = 5 # Set the last element
>>> some_list[-2] = 3 # Set the second to last element
>>> some_list
[1, 3, 5]
MyList = [1, 2, 3, 4, 5]
print(MyList[len(Mylist)-1])
# Makes you look professional