Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

access list items in python

#Negative indexing means start from the end

-1 refers to the last item, -2 refers to the second last item etc.

thislist = ["apple", "banana", "cherry"]
print(thislist[-1])

#Outputt: cherry
 
PREVIOUS NEXT
Tagged: #access #list #items #python
ADD COMMENT
Topic
Name
2+7 =