def replace_20_with_200(lst, find_num, replace_num):
for i in range(len(lst)):
if lst[i] == find_num:
lst[i] = replace_num
break
return lst
lst = [5, 10, 15, 20, 25, 50, 20]
replace_20_with_200(lst, 20, 200)
[5, 10, 15, 200, 25, 50, 20]
lst = [5, 20, 15, 20, 25, 50, 20]
def remove_all_20s(lst, element):
count = lst.count(element)
for i in range(count):
lst.remove(element)
return lst
remove_all_20s(lst, 20)
[5, 15, 25, 50]
def print_lists(lst1, lst2):
if len(lst1) != len(lst2):
print("Both lists should be of same size. Exiting the function.")
else:
for i in range(len(lst1)):
print(lst1[i], lst2[-(i+1)])
lst1 = [10, 20, 30, 40]
lst2 = [100, 200, 300, 400]
print_lists(lst1, lst2)
10 400 20 300 30 200 40 100