Last active
August 17, 2017 13:57
-
-
Save jbiason/557a590c99eeb72281c853f768a5496f 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
| from __future__ import print_function | |
| import random | |
| import argparse | |
| CONSONANTS = ['f', 'j', 'c', 'l', 'n'] | |
| PASSPHRASE = '{}u{}am para as {}o{}i{}as' | |
| def totally_random(): | |
| """Run a totally random way.""" | |
| random.shuffle(CONSONANTS) | |
| print(PASSPHRASE.format(*CONSONANTS)) | |
| def switch_two(): | |
| """Run by changing two steps at a time.""" | |
| first = random.randint(0, 1) | |
| second = random.randint(2, 4) | |
| tmp = CONSONANTS[first] | |
| CONSONANTS[first] = CONSONANTS[second] | |
| CONSONANTS[second] = tmp | |
| print(PASSPHRASE.format(*CONSONANTS)) | |
| if __name__ == "__main__": | |
| args = argparse.ArgumentParser() | |
| args.add_argument('-t', '--totally', | |
| dest='totally', | |
| default=False, | |
| action='store_true', | |
| help='Like, toootaly random') | |
| args.add_argument('-s', '--short', | |
| dest='short', | |
| default=False, | |
| action='store_true', | |
| help='Not so random') | |
| result = args.parse_args() | |
| if result.totally: | |
| totally_random() | |
| elif result.short: | |
| switch_two() | |
| else: | |
| print('Dude, option!') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment