Skip to content

Instantly share code, notes, and snippets.

@serpent213
Created December 9, 2018 18:52
Show Gist options
  • Save serpent213/649d22c23110e4bd2c2192863c8594c7 to your computer and use it in GitHub Desktop.
Save serpent213/649d22c23110e4bd2c2192863c8594c7 to your computer and use it in GitHub Desktop.
phone.py diff
--- phone.orig.py 2018-12-09 19:51:18.000000000 +0100
+++ phone.py 2018-12-09 19:46:12.000000000 +0100
@@ -1,23 +1,25 @@
+#!/usr/bin/env python
+
def isPhoneNumber(text):
if len(text) != 11:
return False
for i in range(0,3):
- if not text[i].isdecimal():
+ if not text[i].isdigit():
return False
if text[3] != '-':
return False
- for i in range(3, 7):
- if not text[i].isdecimal():
+ for i in range(4,7):
+ if not text[i].isdigit():
return False
if text[7] != '-':
return False
- for i in range(8, 11):
- if not text[i].idecimal():
+ for i in range(8,11):
+ if not text[i].isdigit():
return False
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment