1.

Kritika was asked to accept a list of even numbers but she did not put the relevant condition while accepting the list of numbers. You are required to write a user defined function oddtoeven(L) that accepts the List L as an argument and convert all the odd numbers into even by multiplying them by 2 .

Answer»

def oddtoeven(L) :

for i in range (len (L)):

if (L[i]%2! = 0):

L[i] = L[i]*2



Discussion

No Comment Found

Related InterviewSolutions