Kritika was asked to accept a list of even numbers but she did not put the relevant condition while accepting the list. Write a user-defined function oddtoeven(L) that accepts the List L as an argument and converts all the odd numbers into even by multiplying them by 2.
Answers
Answered by
1
Answer:
def oddtoeven(L):
for i in range(len(L)):
if(L[i]%2 == 1):
L[i] = L[i]*2
numbers = [9,8,4,5,2,7,1,3,0,2]
print("Original list-")
print(numbers)
oddtoeven(numbers)
print("List After converting every odd number in the list to even number-")
print(numbers)
Explanation:
Similar questions
Physics,
6 hours ago
Math,
6 hours ago
Environmental Sciences,
6 hours ago
Social Sciences,
8 months ago
Math,
8 months ago