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 inta 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 onlyevenslst: ListListint ListListint:
Return a list of sublists of lst including empty sublists that contain
only even integers, in the order in which they occur in lst
onlyevens
evenlists
for sublist in lst:
# write your code here
return evenlists
def hasonlyevenslst: Listint bool:
Return whether lst has only even numbers. Return True on empty list.
hasonlyevens
True
hasonlyevens
True
hasonlyevens
False
# write your code here
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
