How do you access the final item in a list without knowing how many items are in that list?
for example:
list_items = [0,0,0,0,....... ,2]
print (the last item in the list)
How do you access the final item in a list without knowing how many items are in that list?
for example:
list_items = [0,0,0,0,....... ,2]
print (the last item in the list)
 
    
     
    
    I  think you just mean the last index, [-1] returns the last element:
>>> print(list_items[-1])
2
Indices from the end towards the start are accessed with negative integers.
