# Swap function
def swapList(newList):
size = len(newList)
# Swapping
temp = newList[0]
newList[0] = newList[size - 1]
newList[size - 1] = temp
return newList
# Driver code
newList = []
newList = [int(item) for item in input("Enter the list items : ").split()]
print(swapList(newList))
#clcoding.com
Enter the list items : 4 5 2 3 8 6 [6, 5, 2, 3, 8, 4]