Q. Write a Program to multiply an element by 2 if it is an odd index for a given list containing both numbers and strings.

 

Answer =

 



lst = eval (input ("Enter the list : - "))
for i in range (len(lst)) :
    if (i) % 2 != 0 :
        lst[i] = lst[i] * 2
print(lst)

 

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post