Cara is applying for several different jobs.
The online application forms ask her to respond within a specific character count.
Cara needs to check that her answers fit into the character limit.

Annoyingly, some application forms count spaces as a character, and some don't.

Your challenge: 

Write Cara a function `charCheck()` with the arguments:

- `"text"`: a string containing Cara's answer for the question
- `"max"`: a number equal to the maximum number of characters allowed in the answer
- `"spaces"`: a boolean which is `True` if spaces are included in the character count and `False` if they are not

The function `charCheck()` should return an array: `[True, "Answer"]` , where `"Answer"` is equal to the original text, if Cara's answer is short enough.

If her answer `"text"` is too long, return an array: `[False, "Answer"]`. 
The second element should be the original `"text"` string truncated to the length of the limit.

When the `"spaces"` argument is `False`, you should remove the spaces from the `"Answer"`.

For example:

- `charCheck("Cara Hertz", 10, True)` should return `[ True, "Cara Hertz" ]`
- `charCheck("Cara Hertz", 9, False)` should return `[ True, "CaraHertz" ]`
- `charCheck("Cara Hertz", 5, True)` should return `[ False, "Cara " ]`
- `charCheck("Cara Hertz", 5, False)` should return `[ False, "CaraH" ]`

Difficulty: EASY
Starter code: def charCheck(text, mx, spaces):
	

Solutions:
def charCheck(text, mx, spaces):
	text = text if spaces else text.replace(' ', '')
	return [len(text) <= mx, text[:mx]]


def charCheck(text, mx, spaces):
	if not spaces:
		text = text.replace(' ', '')
	return [len(text) <= mx, text[:mx]]


def charCheck(s, mx, spaces):
	res = ''.join((s.split(), s)[spaces])
	return [len(res) <= mx, res[:mx]]


def char_check(txt, mx, spc):
	if not spc:
		txt = txt.replace(' ', '')
	return [len(txt) <= mx, txt[:mx]]
charCheck = char_check


def charCheck(text, mx, spaces):
	return (lambda txt: [len(txt) <= mx, txt[:mx]])([text.replace(' ', ''), text][spaces])


def charCheck(text, mx, spaces):
	if spaces == True:
		return [len(text) <= mx, text[:mx]]
	else:
		t = text.replace(' ', '')
		return [len(t) <= mx, t[:mx]]


def charCheck(text, mx, spaces):
	stringa = ''
	limit = False
	result = ''
	limit_val = 0
	if spaces:
		stringa = text
	else:
		stringa = text.replace(' ', '')
	limit_val = mx - len(stringa)
	if limit_val >= 0:
		limit = True
		limit_val = len(stringa)
	else:
		limit_val = mx
	for i in range(limit_val):
		result += stringa[i]
	return [limit, result]


def charCheck(text, mx, spaces):
	if spaces == False:
		text = text.replace(' ', '')
	return [len(text) <= mx, text[:mx]]


def charCheck(s, m, sp):
	s = s.replace([' ', ''][sp], '')
	return [s[:m] == s, s[:m]]


def charCheck(r, l, s):
	t = r.replace(-~-s * ' ', '')
	return [t == t[:l], t[:l]]