Write a function to split a string and convert it into an array of words. For example:

```python
"Robin Singh" ==> ["Robin", "Singh"]

"I love arrays they are my favorite" ==> ["I", "love", "arrays", "they", "are", "my", "favorite"]
```

Difficulty: EASY
Tags: String algorithms

Fundamentals

Data structures
Skill types: Data structures

Starter code:
def string_to_array(s):
	

Solutions:
def string_to_array(string):
	return string.split(' ')


def string_to_array(string=''):
	return string.split() if string else ['']


def string_to_array(s):
	return s.split(' ')


def string_to_array(string):
	array = string.split(' ')
	return array


def string_to_array(string):
	return string.split() or ['']


def string_to_array(s):
	words = []
	if s == '':
		words.append(s)
	else:
		words = s.split()
	return words


def string_to_array(s):
	word = s.split(' ')
	return word


def string_to_array(s):
	if s is '':
		return s.split(',')
	else:
		return s.split()


def string_to_array(s):
	arr = []
	words = s.split(' ')
	if len(s) == 0:
		return ['']
	for word in words:
		arr.append(word)
	return arr


def string_to_array(s):
	lst = []
	split_s = s.split()
	if s == '':
		lst.append('')
	for letter in split_s:
		lst.append(letter)
	return lst


string_to_array = lambda s: s.split() or ['']


def string_to_array(string):
	i = string.split(' ')
	return i


def string_to_array(string):
	retList = list()
	retList = string.split(' ')
	return retList


def string_to_array(string):
	new_string = string.split(' ')
	text = []
	for i in new_string:
		text.append(i)
	return text


def string_to_array(s):
	result = []
	t = ''
	e = ' '
	for i in s:
		if i not in e:
			t = t + i
		else:
			result.append(t)
			t = ''
	result.append(t)
	return result


def string_to_array(s):
	arr = []
	temp = ''
	for i in s:
		if i != ' ':
			temp += i
		else:
			arr += [temp]
			temp = ''
	arr += [temp]
	return arr


from re import findall

def string_to_array(s):
	return findall('\\w+', s) or ['']


import re

def string_to_array(s):
	return re.split('[;,\\s]\\s*', s)


def string_to_array(s):
	return [s.split(), ['']][not s]


def string_to_array(s: str) -> list:
	return s.split(' ')


string_to_array = lambda x: x.split(' ')


def string_to_array(s):
	if len(s) == 0:
		return ['']
	else:
		lst = s.split()
	return lst


string_to_array = lambda s: s.split() if bool(s) else ['']


def string_to_array(s):
	return [''] if not len(s) else s.split()


def string_to_array(s):
	if len(s) > 1:
		new = s.split()
	else:
		new = ['']
	return new


def string_to_array(s):
	return [item for item in s.split(' ')]


def string_to_array(s):
	l = []
	if s == '':
		l.append('')
		return l
	else:
		for i in s.split():
			l.append(i)
		return l


def string_to_array(s):
	if len(s) == 0:
		_list = []
		_list.append('')
		return _list
	return list(s.split())


def string_to_array(string):
	str = string.split(' ')
	return str


def string_to_array(s):
	if s == '':
		return ['']
	return [i for i in s.split()]


def string_to_array(s):
	r = ['']
	if s:
		r = s.split()
	return r


def string_to_array(s):
	return list(s.split()) if list(s) else ['']


def string_to_array(s):
	ll = list(s.split(' '))
	return ll


def string_to_array(s):
	if s == '':
		return ['']
	s_list = []
	split_string = s.split()
	for word in split_string:
		s_list.append(word)
	return s_list


def string_to_array(s):
	a = s.split(' ')
	return a
print(string_to_array('I are arrays favorites love my they'))


def string_to_array(s):
	final_array = s.split(' ')
	return final_array


def string_to_array(s):
	new_words = s.split(' ')
	return new_words


def string_to_array(s):
	k = s.split()
	if s == '':
		return [s]
	else:
		return k


def string_to_array(s):
	pog = s.split(' ')
	return pog


def string_to_array(s):
	array = []
	tmp_string = ''
	for i in s:
		if i == ' ':
			array.append(tmp_string)
			tmp_string = ''
		else:
			tmp_string = tmp_string + i
	array.append(tmp_string)
	return array


def string_to_array(s):
	if len(s) >= 1:
		words = s.split()
		return words
	else:
		return ['']


string_to_array = lambda s: s and s.split() or ['']


def string_to_array(s):
	sList = list(s.split(' '))
	return sList


def string_to_array(s):
	return s.split and s.split(' ')


def string_to_array(s):
	if len(s) <= 0:
		return ['']
	else:
		l = s.split()
		return list(l)


def string_to_array(s):
	return s.split(' ')
string_to_array('Basic tests')


def string_to_array(s):
	text = []
	text = s.split(' ')
	return text


def string_to_array(s):
	words = ''
	answer = []
	for i in s:
		if i == ' ':
			answer.append(words)
			words = ''
		else:
			words += i
	answer.append(words)
	return answer


def string_to_array(s):
	c = []
	for x in s.split():
		c.append(x)
	if len(s) == 0:
		return ['']
	return c


def string_to_array(s):
	words = s.split()
	if not words:
		words.insert(0, '')
	return words


def string_to_array(s):
	con = s.split(' ')
	return con


def string_to_array(s):
	n_s = list(s.split(' '))
	return n_s


def string_to_array(s):
	s = s.replace(' ', ',')
	return s.split(',')


def string_to_array(stroca):
	return stroca.split(' ')


def string_to_array(s):
	if s == '':
		return ['']
	else:
		return str.split(s)


def string_to_array(s):
	if s is '':
		return ['']
	l = list()
	for i in s.split():
		l.append(i)
	return l


def string_to_array(s):
	if s == '':
		return ['']
	else:
		words = s.split()
		for word in words:
			return words


def string_to_array(s):
	return [str(w) for w in s.split()] if len(s) else ['']


ans = []

def string_to_array(s):
	ans = s.split()
	if s == '':
		ans = ['']
	return ans


def string_to_array(s):
	string_list = s.split(' ')
	return string_list


def string_to_array(s):
	res = s.split()
	if len(s) == 0:
		return ['']
	return res


def string_to_array(s):
	if s == '':
		res = [s]
	else:
		res = s.split()
	return res


def string_to_array(s):
	if s:
		arr = s.split()
		return arr
	else:
		return ['']


def string_to_array(s):
	p = s.split(' ')
	return p


def string_to_array(s):
	res = s.split(' ')
	return res


def string_to_array(s):
	if len(s):
		return s.split()
	return ['']


def string_to_array(s):
	return list(s.split()) or ['']


def string_to_array(s):
	return list(filter(lambda x: x, s.split(' '))) if s else ['']


def string_to_array(s):
	import re
	arr = []
	if s == '':
		arr = ['']
	else:
		pattern = '(\\w+)'
		arr = re.findall(pattern, s)
	return arr


def string_to_array(s):
	arr = []
	if s == '':
		arr = ['']
	else:
		import re
		pattern = '(\\w+)'
		arr = re.findall(pattern, s)
		arr = [x.strip(' ') for x in arr]
	return arr


def string_to_array(s):
	if s == '':
		array = ['']
	else:
		array = []
	s = s.split()
	for i in s:
		array.append(i)
	return array


def string_to_array(s):
	res = []
	for i in s.split(' '):
		res.append(i)
	return res