Python program to interchange first and last elements in a list?

Опубликовано: 02 Ноябрь 2024
на канале: DevOps Rulers
475
4

#Python program to interchange first and last elements in a list
#Swapping Function Thank you for watching

def output(lst):
l=len(lst)

#Swapping
t = lst[0]
lst[0] = lst[l-1]
lst[l-1] = t

return lst
lst = [9,10,11,14,17,19]
print(output(lst))




#python #programming #coding #programmer #developer #code #software #tech #pythonproblem #function