<|im_start|>user
consider this code:

somelist = []

for x in something:
    element = dosomething(x)

if "element" retuns a list, how do I append the list to somelist in a way that does not create a list of lists?

like for example, if somelist = ['banana'] and element = ['apple','orange'], how do I make a list of ['banana','apple','orange'] ?<|im_end|>
<|im_start|>assistant
You can use the `extend()` function of a list in Python. `extend()` adds elements from another list (or any iterable) to the end of the current list.

Here's how you can use `extend()` in your code:

```python
somelist = ['banana']

for x in something:
    element = dosomething(x)
    if isinstance(element, list):   # check if 'element' is a list
        somelist.extend(element)
```

In this modified version of your code, `somelist.extend(element)` will add each item in `element` to `somelist`. If `element` is ['apple', 'orange'], `somelist` will become ['banana', 'apple', 'orange']. 

Note the use of `isinstance()` to check if `element` is a list. This is a safeguard in case `dosomething(x)` returns something other than a list. If `dosomething(x)` always returns a list, you can remove this check.<|im_end|>
