add last item of array at the first index of the array python

Solutions on MaxInterview for add last item of array at the first index of the array python by the best coders in the world

showing results for - "add last item of array at the first index of the array python"
Camilla
06 Nov 2016
1def add_last_item_at_first_index(arr):
2    temp = arr[len(arr) - 1]
3    i = 0
4    while i < len(arr):
5        temp1 = arr[i]
6        arr[i] = temp
7        temp = temp1
8        i = i + 1
9    return arr