Solution Exercise 3: python algorithm that determines the list of odd index items and the list of even index items

Exercise 3

Write a python algorithm as a function which takes a list l as parameters and returns a tuple of two lists (l_even, l_odd) where l_even is made up of the elements of l with an even index and l_old is made up of the elements with an odd index. Example: if: L = ["Python", "Java", "C++", "C#", "VB.Net", "Javascript"], the algorithm returns: (['Python', 'C++', 'VB .Net'], ['Java', 'C#', 'Javascript'])

Solution




 

Younes Derfoufi
CRMEF OUJDA

1 thought on “Solution Exercise 3: python algorithm that determines the list of odd index items and the list of even index items

Leave a Reply

Your email address will not be published. Required fields are marked *