Last active
August 29, 2015 14:04
-
-
Save erewok/6fd61cea6e8e7f70fb67 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
#!/usr/local/bin/python3 | |
from random import choice, randint | |
import sys | |
all_letters = "abcdefghijklmnñopqrstuvwxyz" | |
vowels = "aeiouy" | |
suffix = "bertos" | |
consonants = list(filter(lambda x: x not in vowels, all_letters)) | |
def switch_letter(this_letter=None): | |
def opposite(letter): | |
options = set("vc") | |
letter = set(letter) | |
return (options - letter).pop() | |
options = {'v': vowels, | |
'c': consonants} | |
if this_letter is None: | |
random_start = options[choice('vc')] | |
return choice(random_start) | |
else: | |
return choice(options[opposite(this_letter)]) | |
def taco_shop_controller(length): | |
if length <= 0: | |
return suffix | |
get_letter = switch_letter() | |
taco_shop_name = get_letter | |
while length > 1: | |
if get_letter in vowels: | |
get_letter = switch_letter('v') | |
else: | |
get_letter = switch_letter('c') | |
taco_shop_name += get_letter | |
length -= 1 | |
return taco_shop_name + suffix | |
if __name__ == '__main__': | |
length = int(sys.argv[1]) | |
if length > len(suffix): | |
length -= len(suffix) | |
else: | |
pass | |
print(taco_shop_controller(length)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment