Write a python program to create an array of 10 integers and display the array items. The array should be populated with random integers from 10 to 50. The program should also display separately all the even numbers within the array.
import random
arr = [random.randint(10, 50) for _ in range(10)]
print("Array: ", arr)
even_arr = list(filter(lambda x: x % 2 == 0, arr))
print("Even numbers: ", even_arr)
Comments
Leave a comment