Question: Please Do Parts a) , b)! Question 9 30 pts a programming pro one, up g on e wor ing s e signa e, parame

Please Do Parts a) , b)!

Please Do Parts a) , b)! Question 9 30 pts a programming

pro one, up g on e wor ing s e signa e,

Question 9 30 pts a programming pro one, up g on e wor ing s e signa e, parame ive e namea oa To get credit for this problem the code must NOT use: for loops, while loops, functions from other modules, the filter function, or any library functions except type), len), and list slices A flat list has elements that are not lists themselves, while a nested list has some elements that are lists. E.g. [1,2,3] is a flat list, while [1, [[2], 3], 4] is a nested list. For this problem a list Ist is defined flat if for each element x in Ist, type(x)!- list. The empty list [] is considered to be flat. The flat version of [1, [[2], 3], 4] is [1, 2, 3, 4] a) Write a recursive function filterflatlst(lst, predicate) that takes as parameters a list Ist (assumed to be flat) and a function predicate and returns a list with the elements x from Ist for which predicate(x) returns True filterflatlst(l1, predicate) returns [], the empty list

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 Databases Questions!