Write a python-3 user-defined function called even(A) that returns a 1D array of even elements. The function is in charge of filtering even values from an input of a n-dimensional 2D array of integers named A. EXAMPLE: 1 2 3 4 5 6 7 8 9 2d array 2 4 6 8 1d array
Added by Sean B.
Close
Step 1
Here's the code: ```python def even(A): result = [] # create an empty list to store even elements # iterate through each row in the 2D array for row in A: # iterate through each element in the row for element in row: Show more…
Show all steps
Your feedback will help us improve your experience
Chandra Jain and 82 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Write a function that takes 2 arrays and prints the members of the first array that are present in the second array. (Python - membership comprehension)
Willis J.
Using Python, create program to find the remainder of array multiplication divided by n.
Shelayah R.
(In python)- Given an array of integers, return the difference of the first 3 elements in the array. If the array will result in a negative number, just return the difference of the elements that exist, returning 0 if the array is length 0 or less. Then, create a flowchart that correlates to your algorithm.
Akash M.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Watch the video solution with this free unlock.
EMAIL
PASSWORD