Code :
# This function is used to swap the first and last element of the list
def SwapList(list):
ln = len(list)
buf = list[0]
list[0] = list[ln-1]
list[ln-1] = buf
return list
l = [13, 36, 10, 57, 25]
print(SwapList(l))
Output :
[25, 36, 10, 57, 13]
0 Comments
Ask Your Queries in the comments