Write a function, that doubles every second integer in a list starting from the left.

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Starter code: def double_every_other(lst):
	

Solutions:
def double_every_other(l):
	return [x * 2 if i % 2 else x for (i, x) in enumerate(l)]


double_every_other = lambda l: [e * (1 + i % 2) for (i, e) in enumerate(l)]


def double_every_other(lst):
	return [x * (i % 2 + 1) for (i, x) in enumerate(lst)]


def double_every_other(lst):
	return [2 * v if i & 1 else v for (i, v) in enumerate(lst)]


def double_every_other(lst):
	for (ind, item) in enumerate(lst):
		if ind % 2 != 0:
			lst[ind] = item * 2
	return lst


def double_every_other(lst):
	return [a * 2 if i % 2 else a for (i, a) in enumerate(lst)]


def double_every_other(lst):
	return [x * 2 if i % 2 != 0 else x for (i, x) in enumerate(lst)]


def double_every_other(lst):
	return [num * 2 if index % 2 != 0 else num for (index, num) in enumerate(lst)]