wap to multiply an element by 2 if it is odd index for a given list containing both numbers and strings
Answers
Answered by
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
5
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))
Similar questions