Making a flat list out of list of lists in python?



Making a flat list out of list of lists in python?..

Answer / Navneet Kumar Verma

In Python, you can use the `extend()` method or the `+` operator to concatenate multiple lists and flatten them into a single list. Here is an example using the extend() method:nn``pythonnflat_list = []nsub_lists = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]nfor sub_list in sub_lists:n flat_list.extend(sub_list)nprint(flat_list)``

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

Where do you use python programming? Can you describe in detail?

1 Answers  


What are tuples used for?

1 Answers  


How does inheritance work in python?

1 Answers  


Explain in detail – inheritance in python?

1 Answers  


What are the key features of using python?

1 Answers  


Write a program to find the max value from a list without using max()?

1 Answers  


What is python encapsulation?

1 Answers  


What do you mean by list comprehension?

1 Answers  


What is the namespace in python?

1 Answers  


What program to write python?

1 Answers  


What does this mean: *args, **kwargs? And why would we use it?

1 Answers  


How to check if string A is substring of string B?

1 Answers  


Categories