Given a list, and we have to create two lists 1) list with EVEN numbers and 2) list with ODD numbers from given list in Python.
Example:
Input:
List1 = [11, 22, 33, 44, 55]
Output:
List with EVEN numbers: [22, 44]
List with ODD NUMBERS: [11, 33, 55]
Logic:
To create lists with EVEN and ODD numbers, we will traverse each element of list1 and append EVEN and ODD numbers in two lists by checking the conditions for EVEN and ODD.
Program:
Output
list1: [11, 22, 33, 44, 55] listEven: [22, 44] listOdd: [11, 33, 55]
need an explanation for this answer? contact us directly to get an explanation for this answer