Computer Science, asked by varnika71, 4 months ago

wap to multiply an element by 2 if it is odd index for a given list containing both numbers and strings​

Answers

Answered by 271661
1

Answer:

Given an array of integers. The task is to write a program to find the product of elements at even and odd index positions separately.

Explanation:

hope this heped luv ; )

Answered by jai696
5

\large\mathsf\color{pink}{Solution\: using\: python\: 3}

def mul_elements(arr):

for idx, item in enumerate(arr):

if idx % 2 != 0:

arr[idx] = item * 2

return arr

arr = ["tomatoes", 6, "varnika", 9, 53, "bananas"]

print(mul_elements(arr))

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Similar questions