There is something wrong with the following code! Debug the code to satisfy the docstring.defbad_list_flattener
(lst1, lst2):
Flattens both lst1 and lst2, and returns the
concatenation of the two flattened lists. Flattening
a list means to collapse the list into one
dimension (like np.flatten).
>>> girls = [[‘Rachel’, ‘Green’], [‘Phoebe’, ‘Buffay’]]
>>> boys = [[‘Ross’, ‘Geller’], [‘Chandler’, ‘Bing’]]
>>> bad_list_flattener(girls, boys)
[‘Rachel’, ‘Green’, ‘Phoebe’, ‘Buffay’, ‘Ross’, ‘Geller’, ‘Chandler’, ‘Bing’]
>>> cats = [[‘Persian’], [‘British’, ‘Shorthair’]]
>>> dogs = [[‘Golden’, ‘Retriever’]]
>>> bad_list_flattener(dogs, cats)
[‘Golden’, ‘Retriever’, ‘Persian’, ‘British’, ‘Shorthair’]
newlist1 = []
newlist2 = []
for inner_lst in lst1:
for item in inner_lst:
newlist1 += item
for inner_lst in lst2:
for item in inner_lst:
newlist2 += item
return newlist1 + newlist2

please debug this code

Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code “Newclient”

The post code appeared first on Superb Professors.

"Order a Custom Paper on Similar Assignment! No Plagiarism! Enjoy 20% Discount"