Skip to content

Instantly share code, notes, and snippets.

@leotrs
Created August 12, 2016 18:06
Show Gist options
  • Save leotrs/82f0f945845bbaef69953c88efd28d76 to your computer and use it in GitHub Desktop.
Save leotrs/82f0f945845bbaef69953c88efd28d76 to your computer and use it in GitHub Desktop.
"""
Earlier today, in the Recurse Center Slack Room, one of my mentors jokingly suggested
a project idea for a "cool metal band generator." I thought that was a fun idea,
so I made one. Whether the names generated are cool or not is up for debate.
Some examples:
* asses vile
* enfeeble revocation
* dominie dying fetus
* overexercise nile
* brain drill meathook
"""
import random
def make_list(filename):
with open(filename) as infile:
lines = infile.readlines()
return [l.strip() for l in lines]
def metal_bands(words_generated=1):
for _ in range(words_generated):
metal_word = random.choice(make_list("metalbands.txt")).lower()
question = input("Do you want to choose a word? YES/NO: ").upper()
if question.upper() == "YES":
user_word = input("Type a random word: ")
print(user_word + " " + metal_word)
else:
random_word = random.choice(make_list("words.txt"))
print(random_word + " " + metal_word)
if __name__ == '__main__':
metal_bands()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment