Solution Exercise 62: algorithm that multiplies the elements of a given list
Exercise 62 Given a list of integers L, write an algorithm in Python which multiplies the elements of L of even index by 2 and those of odd index by…
Python Courses & Exercises with solutions !
Exercise 62 Given a list of integers L, write an algorithm in Python which multiplies the elements of L of even index by 2 and those of odd index by…
In this first lesson, we'll start by defining what is Bootstrap. We then show the advantages as well as the limits of this framework so that you immediately have an…
Exercise 61 Resume the previous exercise (Exercise60) without using the reverse() method in python. Solution def reverseList (L): # initialization of the inverted list lReverse = [] # iterate over…
Exercise 60 Write a Python algorithm that reverse the order of the elements of a list using the reverse() method. Example if L = ['Java', 'Python', 'PHP', 'C ++'], the…
Exercise 55 Write an algorithm in Python to sort a list according to the insertion sort algorithm. Solution # Python insertion sort algorithmdef sort_insertion (tab): # Browse from 1 to…
Exercise 54 Write a Python algorithm as a function which takes as parameter a list of integers L = [n1, n2, n3, ...., np] and which returns the list: [n1,…
Exercise 53 Write an algorithm in Python allowing to determine the penultimate index of an element in a list without using any predefined function in Python. Example if L =…