+ 1
Howto solve this solution with python?
2. This is a program to analyze mobile numbers using match() function. Please fill out the blanks to get the outcomes as below. Note: re.compile() complies a regular expression pattern into a regular expression object, which can be used for matching using its match() or search(). Mobile phone number in Korea starts with 3 digit numbers followed by 3~4 and 4 digits fixed customer numbers. (e.g., 010-2345-5678 or 010-234-5678) <Output> ('010', '123', '4567') 010-123-4567 ('123', '4567') 0
1 Odpowiedź
+ 1
You mast use re ?
def check (arr):
if len(arr) != 3:
return 0
if len(arr[o]) != 3:
return 0
l = len(arr[1])
if l != 3 or l != 4:
return 0
if arr[2] != 4:
return 0
return "-".join(arr)