Last active
July 20, 2017 22:36
-
-
Save nillsondg/77d33c08f79d193b4b54f631a3dc7752 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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