Question: We say that a nested list is semi-homogeneous if it is a single integer, or it is a list satisfying both of these conditions .

We say that a nested list is semi-homogeneous if it is a single integer, or it is a list satisfying both of these conditions . Its sub-nested-lists are either all integers or all lists. . Its sub-nested-lists are all semi-homogeneous. An empty list is considered to be semi-homogeneous. Your goal here is to write a recursive function that determines whether a nested list is semi-homogeneous. We've left plenty of space for you to write doctests-this is an excellent first step to make sure you understand this definition! def semi_homogeneous (obj: Union[int, List]) -> bool: ""Return whether the given nested list is semi-homogeneous. Write some doctests in the space below! >7) at[l, 2,3] 5 Semi- homogeneous (a) > b LCI1, C2,31.CE+,s,6.71]] TPUE Semi homageneus cb) TRUE False f is instane Cobj, int)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
