Skip to content

Instantly share code, notes, and snippets.

@nillsondg
Last active July 20, 2017 22:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nillsondg/77d33c08f79d193b4b54f631a3dc7752 to your computer and use it in GitHub Desktop.
Save nillsondg/77d33c08f79d193b4b54f631a3dc7752 to your computer and use it in GitHub Desktop.
f = open("output.txt","w")
with open("input.txt", 'r') as fh:
for line in fh:
name, phone = line.split(" ")
phone = phone.strip()
numbers = {}
for num in phone:
if num in numbers:
numbers[num] += 1
else:
numbers[num] = 1
if len(numbers) <= 3:
f.write(name + " " + phone + "\n")
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment