Question: Lists of even integers This problem has you write a function to process a List [ List [ int ] ] ( a list of

Lists of even integers
This problem has you write a function to process a List [List [int]](a list of lists of integers), and accumulate a List [List [int]. The starter code provides an accumulator for the result and a loop over the sublists, and you need to write the code that checks whether sublist contains only even ints. Note how the helper function is used!
```
|from typing import List
def only_evens(lst: List[List[int]])-> List[List[int]]:
"""Return a list of sublists of lst (including empty sublists) that contain
only even integers, in the order in which they occur in lst.
>>> only_evens([[1,2,4],[4,0,6],[],[22,4,3],[2]])
[[4,0,6],[],[2]]
""!"
even_lists =[]
for sublist in lst:
# write your code here
return even_lists
def has_only_evens(lst: List[int])-> bool:
"""Return whether lst has only even numbers. Return True on empty list.
>>> has_only_evens([])
True
>>> has_only_evens([2,4,-6])
True
>>> has_only_evens([2,4,3,-6])
False
""!"
# write your code here
```
Lists of even integers This problem has you write

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!