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.
Case study one page Case study one page Case study one page Case study one…
Business Calculus quiz that is 10 questions and has an hour time limit. Must be…
Write a 175- to 265-word response to the following: What constitutes “robust interoperability,†and what…
For this News Briefing Quest task , pick and analyze a U.S. political news article…
ACC 610 Milestone TwoGuidelines and Rubric This is the secondof three milestone assignments that will…
Please answer the questions in the attachment. I have sent you the required materials. Send…