If Sonia has a list named colleges
in Python and wants to print the last item from that list, she can access the last item using index -1
. Here's the code she can use:
colleges = [...] # Assume this has 10 items
print(colleges[-1])
In this code, replace [...]
with the actual items in the list. The -1
index accesses the last item in the list, regardless of the number of items it contains.