Linked lists are data structures composed of nested or chained objects, each containing a single value and a reference to the next object. 

Here's an example of a list:

```python
class LinkedList:
    def __init__(self, value=0, next=None):
        self.value = value
        self.next = next
        
LinkedList(1, LinkedList(2, LinkedList(3)))

```

Write a function listToArray (or list\_to\_array in Python) that converts a list to an array, like this:

```
[1, 2, 3]
```

Assume all inputs are valid lists with at least one value. For the purpose of simplicity, all values will be either numbers, strings, or Booleans.

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Starter code: def list_to_array(lst):
	

Solutions:
def list_to_array(lst):
	arr = []
	while lst != None:
		arr.append(lst.value)
		lst = lst.next
	return arr


def list_to_array(lst):
	return [lst.value] + list_to_array(lst.next) if lst else []


def list_to_array(ll):
	output = []
	while ll:
		output.append(ll.value)
		ll = ll.__next__
	return output


def list_to_array(lst):
	res = []
	while lst:
		res.append(lst.value)
		lst = lst.__next__
	return res


def list_to_array(lst):
	list = []
	while lst is not None:
		list.append(lst.value)
		lst = lst.__next__
	return list


list_to_array = lambda l: list() if l == None else [l.value] + list_to_array(l.next)


def list_to_array(lst):
	list = []
	while lst:
		list.append(lst.value)
		lst = lst.next
	return list


def list_to_array(lst):
	array = []
	while lst:
		array.append(lst.value)
		lst = lst.next
	return array


def list_to_array(node):
	return [] if node is None else [node.value] + list_to_array(node.next)


def list_to_array(node):
	arr = []
	while node:
		arr.append(node.value)
		node = node.next
	return arr