mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2024-11-23 20:11:07 +00:00
24 lines
644 B
Python
24 lines
644 B
Python
def check_phone_number(string):
|
|
if len(string) != 12:
|
|
return False
|
|
for i in range(0, 3):
|
|
if not string[i].isdecimal():
|
|
return False
|
|
if string[3] != '-':
|
|
return False
|
|
for i in range(4, 7):
|
|
if not string[i].isdecimal():
|
|
return False
|
|
if string[7] != '-':
|
|
return False
|
|
for i in range(8, 12):
|
|
if not string[i].isdecimal():
|
|
return False
|
|
return True
|
|
|
|
string = input("Enter a Sentence: ")
|
|
|
|
for i in range(len(string)):
|
|
split = string[i:i+12]
|
|
if check_phone_number(split):
|
|
print('Phone number has been found! : ' + split) |