Sonia has a list called colleges with 10 inches and wants to print the final item on a list which code should be used

1 answer

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.