Solution Exercise 2: python algorithm that swaps the first element of a list with the last

Exercise 2

Write a Python algorithm to swap the first element with the last element of a given list. Example: if L = ["Python", "Java", "C++", "Javascript"], the algorithm returns the list: ["Javascript", "Java", "C++", "Python"]

Solution




 

Younes Derfoufi
CRMEF OUJDA

1 thought on “Solution Exercise 2: python algorithm that swaps the first element of a list with the last

Leave a Reply