Python cara mendapatkan elemen terakhir dalam daftar
some_list = [1, 2, 3]
some_list[-1]
print(some_list)
#Output = 3
Condemned Cottonmouth
some_list = [1, 2, 3]
some_list[-1]
print(some_list)
#Output = 3
list1 = ['a','b','c']
print(list1[-1])
some_list = [1,2,3]
some_list[-1] is the shortest and most Pythonic.
#output = 3
# Get the last element in a List
list = ["A", "B", "C"]
print(list[-1])
list = [1, 2, 3]
print(list[-1]) #prints 3