Write a Python Program to Swap the First and Last Value of a List
Topic: Write a Python Program to Swap the First and Last Value of a List
Solution
a=[2, 3, 8, 9, 2, 4, 6] n = len(a) temp=a[0] a[0]=a[n-1] a[n-1]=temp print("New list is:") print(a)
List all Python Programs