Write the program to swap the first and last value of a list in python
Answers
Answered by
0
Answer:
Explanation:
def swap(x,y):
# create a temporary variable and swap the values
temp = x
x = y
y = temp
return x,y
list = [1,2,3,4]
x = list[0]
y = list[len(list)]
print(swap(x,y))
Similar questions