ATM machines allow 4 or 6 digit PIN codes and PIN codes cannot contain anything but **exactly** 4 digits or exactly 6 digits. 

If the function is passed a valid PIN string, return `true`, else return `false`.

## Examples 
```
"1234"   -->  true
"12345"  -->  false
"a234"   -->  false
```

Difficulty: EASY
Starter code: def validate_pin(pin):
	

Solutions:
def validate_pin(pin):
	return len(pin) in (4, 6) and pin.isdigit()


validate_pin = lambda pin: len(pin) in (4, 6) and pin.isdigit()


def merge(array1, array2):
	array3 = []
	i = 0
	j = 0
	while i < len(array1) and j < len(array2):
		if array1[i] < array2[j]:
			array3.append(array1[i])
			i = i + 1
		else:
			array3.append(array2[j])
			j = j + 1
	return array3 + array1[i:] + array2[j:]

def validate_pin(pin):
	key = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
	if len(pin) == 6 or len(pin) == 4:
		p = [i for i in pin]
		m = merge(key, p)
		if len(set(m)) == len(key):
			return True
		return False
	else:
		return False


def validate_pin(pin):
	if type(pin) != str or len(pin) not in [4, 6]:
		return False
	for c in pin:
		if c not in '0123456789':
			return False
	return True


def validate_pin(pin):
	import re
	if len(pin) == 4 or len(pin) == 6:
		if re.search('[^0-9]', pin) == None:
			return True
	return False


import re

def validate_pin(pin):
	return re.match('(?:\\d{4}|\\d{6})\\Z', pin) is not None


def validate_pin(pin):
	if pin.isnumeric() and len(pin) in [4, 6]:
		return True
	return False


import re

def validate_pin(pin):
	if re.fullmatch('\\d{4}|\\d{6}', pin):
		return True
	else:
		return False


import re

def validate_pin(pin):
	return bool(re.fullmatch('\\d{4}|\\d{6}', pin))


def validate_pin(pin):
	if len(pin) != 4 and len(pin) != 6:
		return False
	for i in range(len(pin)):
		try:
			int(pin[i])
			if i == len(pin) - 1:
				return True
		except ValueError:
			break
	return False


digits = [str(n) for n in range(10)]

def validate_pin(pin):
	return (len(pin) == 4 or len(pin) == 6) and all((p in digits for p in pin))


def validate_pin(pin):
	return pin.isdigit() and (len(pin) == 4 or len(pin) == 6)


def validate_pin(pin):
	num = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}
	pin_set = set(pin)
	if (len(pin) == 4 or len(pin) == 6) and pin_set.issubset(num):
		return True
	else:
		return False


def validate_pin(pin):
	if (type(pin) == int or str(pin).isdigit() == True) and (len(str(pin)) == 6 or len(str(pin)) == 4):
		return True
	else:
		return False


def validate_pin(pin):
	if len(pin) == 4 or len(pin) == 6:
		forbiden = '.,\' /\n=-`~!@#$%^&*)(_+|}{:?><"\'\\qwertuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM'
		for i in forbiden:
			if i in pin:
				return False
		return True
	else:
		return False


import re

def validate_pin(pin):
	return bool(re.search('^[0-9]{4}\\Z$|^[0-9]{6}\\Z$', pin))


def validate_pin(pin):
	return {6: True if [1 for x in pin if x.isdigit()].count(1) == 6 and len(pin) == 6 else False, 4: True if [1 for x in pin if x.isdigit()].count(1) == 4 and len(pin) == 4 else False}.get(len(pin), False)


validate_pin = lambda p: p.isdigit() and len(p) in (4, 6)


def validate_pin(pin):
	return all((pin.isdigit(), len(pin) == 4 or len(pin) == 6))


import re

def validate_pin(pin):
	matches = re.findall('\\d', pin)
	if len(pin) == 4:
		return len(matches) == 4
	elif len(pin) == 6:
		return len(matches) == 6
	else:
		return False


from re import compile
p = compile('\\A(\\d{4}|\\d{6})\\Z')

def validate_pin(pin):
	return bool(p.match(pin))


def validate_pin(pin):
	l = len(pin)
	if (l == 4 or l == 6) and pin.isnumeric():
		return True
	return False


def validate_pin(pin):
	if len(pin) != 4 and len(pin) != 6 or pin.isdigit() == False:
		code = False
	else:
		code = True
	return code


import re

def validate_pin(pin):
	return True if re.match('^(?:\\d{4}|\\d{6})\\Z', pin) else False


def validate_pin(pin):
	if len(pin) == 4 or len(pin) == 6:
		if pin.isnumeric() == True:
			return True
		else:
			return False
	else:
		return False


def validate_pin(pin):
	return pin.isdecimal() and len(pin) in (4, 6)


def validate_pin(num):
	return True if len(num) in [4, 6] and num.isdigit() else False