Last active
November 29, 2015 03:42
-
-
Save kbambz/435081215f42f3c7e970 to your computer and use it in GitHub Desktop.
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
| import random | |
| def unique(values): | |
| return list(set(values)) | |
| def choose_n(values, n): | |
| assert len(values) <= n | |
| return random.sample(values, n) | |
| def main(): | |
| words = [u'some', u'word', u'list', u'list'] | |
| print(choose_n(unique(words), 3)) | |
| if __name__ == '__main__': | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment