Write a function that flattens an `Array` of `Array` objects into a flat `Array`.  Your function must only do one level of flattening.

```python
flatten [1,2,3] # => [1,2,3]
flatten [[1,2,3],["a","b","c"],[1,2,3]]  # => [1,2,3,"a","b","c",1,2,3]
flatten [[[1,2,3]]] # => [[1,2,3]]
```

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Starter code: def flatten(lst):
	

Solutions:
def flatten(lst):
	r = []
	for x in lst:
		if type(x) is list:
			r.extend(x)
		else:
			r.append(x)
	return r


def flatten(lst):
	return sum(([i] if not isinstance(i, list) else i for i in lst), [])


from itertools import chain

def flatten(lst):
	try:
		return list(chain.from_iterable(lst))
	except:
		return lst


from itertools import chain

def flatten(lst):
	try:
		return list(chain(*lst))
	except TypeError:
		return lst


def flatten(lst):
	res = []
	for i in lst:
		if isinstance(i, list):
			res.extend(i)
		else:
			res.append(i)
	return res


def flatten(lst):
	return [item for sublist in [seq if isinstance(seq, list) else [seq] for seq in lst] for item in sublist]


def flatten(lst):
	return sum((([x], x)[isinstance(x, list)] for x in lst), [])


def flatten(lst):
	return [x for xs in lst for x in (xs if isinstance(xs, list) else [xs])]


def flatten(a):
	return [x for b in a for x in (b if type(b) is list else [b])]