Created
May 16, 2017 11:22
-
-
Save pavelch/964cc2ab27e8f214dd7dc79f07a52fac to your computer and use it in GitHub Desktop.
python famous test
This file contains hidden or 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
def knows(person1, person2): | |
#if person1 knows person2 | |
return True | |
def famous(persons): | |
famous = [] | |
for person in persons: | |
if all(map(lambda x: knows(x, person), persons)) and not all(map(lambda x: knows(person, x), persons)): | |
famous.add(person) | |
return famous |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment