Computer Science, asked by parikshitrathore386, 4 months ago

Divides the element of List by 2 if it is even and multiply by 2 if it is odd.

(Note : Do not accept values in List, assume that List has been already made.)

(Eg: If L=[12,3,8,6,9]

Output should be - Changed List is: [6,6,4,3,18])​

Answers

Answered by madhalaimuthucharlas
0

Answer:

L=[12,3,8,6,9]

l =[]

for i in L:

if i %2 ==0:

j = i //2

l.append(j)

else:

j = i *2

l.append(j)

print(l)

Similar questions