Access List Item by Index :

thislist = ["apple", "banana", "cherry"]  # Fruit list
print(thislist[1])                        # Accessing item at index 1

Output :

banana

Access Last Item Using Negative Index :

thislist = ["apple", "banana", "cherry"]  # Fruit list
print(thislist[-1])                       # Last item (cherry)

Output :

cherry

Access List Slice (2:5) :

thislist = ["apple", "banana", "cherry", "orange", "kiwi", "melon", "mango"]
print(thislist[2:5])                      # Items from index 2 to 4

Output :

['cherry', 'orange', 'kiwi']

Slice from Start to Index 3 :

thislist = ["apple", "banana", "cherry", "orange", "kiwi", "melon", "mango"]
print(thislist[:4])                       # Items from beginning to index 3

Output :

['apple', 'banana', 'cherry', 'orange']

Slice from Index 2 to End :

thislist = ["apple", "banana", "cherry", "orange", "kiwi", "melon", "mango"]
print(thislist[2:])                       # Items from index 2 to end

Output :

['cherry', 'orange', 'kiwi', 'melon', 'mango']

Slice with Negative Indexes :

thislist = ["apple", "banana", "cherry", "orange", "kiwi", "melon", "mango"]
print(thislist[-4:-1])                    # From 4th last to 2nd last

Output :

['orange', 'kiwi', 'melon']