Write a python program that returns a new list where all even numbers are replaced with the string “even“
def func(lst):
new_list = []
for i in lst:
if i%2 == 0:
new_list.append('even')
else:
new_list.append(i)
return new_list
print(func([2, 5, 4, 7, 10, 8]))
About Author
I am a Web Developer, Love to write code and explain in brief. I Worked on several projects and completed in no time.
View all posts by Sunil Shaw