Write a Python function that Given a two list of numbers create a new list such that new list should contain only odd numbers from the first list and even numbers from the second list
Topic: Write a Python function that Given a two list of numbers create a new list such that new list should contain only odd numbers from the first list and even numbers from the second list
Solution
def mergeList(list1, list2): thirdList = [] for num in list1: if (num % 2 != 0): thirdList.append(num) for num in list2: if (num % 2 == 0): thirdList.append(num) return thirdList
List all Python Programs