python array last x elements code example Example: python get last element of array arr = ["cat", "dog", "rabbit"] last_element = arr[-1]