Write a function that accepts a string, and returns true if it is in the form of a phone number. Assume that any integer from 0-9 in any of the spots will produce a valid phone number.

Only worry about the following format:
(123) 456-7890   (don't forget the space after the close parentheses)  
Examples:

```
validPhoneNumber("(123) 456-7890")  =>  returns true
validPhoneNumber("(1111)555 2345")  => returns false
validPhoneNumber("(098) 123 4567")  => returns false
```

Difficulty: EASY
Starter code: def validPhoneNumber(phoneNumber):
	

Solutions:
def validPhoneNumber(phoneNumber):
	import re
	return bool(re.match('^(\\([0-9]+\\))? [0-9]+-[0-9]+$', phoneNumber))


import re
prog = re.compile('^\\(\\d{3}\\) \\d{3}-\\d{4}$')

def validPhoneNumber(phone_number):
	return prog.match(phone_number) is not None


def validPhoneNumber(phoneNumber):
	number = ''
	template = '(xxx) xxx-xxxx'
	for l in phoneNumber:
		if l.isdigit():
			number += 'x'
		else:
			number += l
	return number == template


validPhoneNumber = lambda x: bool(__import__('re').match('\\(\\d{3}\\) \\d{3}-\\d{4}$', x))


import re

def validPhoneNumber(phoneNumber):
	return any(re.findall('^\\([0-9]{3}\\)\\s[0-9]{3}-[0-9]{4}$', phoneNumber))


import re

def validPhoneNumber(phoneNumber):
	if re.match('^\\([0-9]{3}\\) [0-9]{3}-[0-9]{4}$', phoneNumber):
		return True
	return False


import re

def validPhoneNumber(phoneNumber):
	pattern = '^\\(\\d{3,3}\\) \\d{3,3}-\\d{4,4}$'
	compiled_pattern = re.compile(pattern)
	return True if re.match(compiled_pattern, phoneNumber) else False


import re
nums = '1234567890'

def validPhoneNumber(pn):
	if len(pn) != len('(123) 456-7890'):
		return False
	elif pn[0] != '(':
		return False
	elif pn[1] not in nums or pn[2] not in nums or pn[3] not in nums:
		return False
	elif pn[4] != ')':
		return False
	elif pn[5] != ' ':
		return False
	elif pn[6] not in nums or pn[7] not in nums or pn[8] not in nums:
		return False
	elif pn[9] != '-':
		return False
	elif pn[10] not in nums or pn[11] not in nums or pn[12] not in nums or (pn[13] not in nums):
		return False
	else:
		return True


def validPhoneNumber(s):
	if s.count(' ') == s.count('-') == 1 and len(s) == 14:
		a = s.replace('(', '').replace(')', '').replace('-', ' ')
		b = a.split()
		return [len(x) for x in b] == [3, 3, 4]
	return False


import re

def validPhoneNumber(num):
	return bool(re.match('^[(][0-9]{3}[)] [0-9]{3}-[0-9]{4}$', num))