Last active
October 6, 2015 12:38
-
-
Save j10sanders/4a9e00812cacd6e11949 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
__author__ = 'Jonathan' | |
import random | |
questions = { | |
"strong": "Do ye like yer drinks strong?", | |
"salty": "Do ye like it with a salty tang?", | |
"bitter": "Are ye a lubber who likes it bitter?", | |
"sweet": "Would ye like a bit of sweetness with yer poison?", | |
"fruity": "Are ye one for a fruity finish?" | |
} | |
ingredients = { | |
"strong": ["glug of rum", "slug of whisky", "splash of gin"], | |
"salty": ["olive on a stick", "salt-dusted rim", "rasher of bacon"], | |
"bitter": ["shake of bitters", "splash of tonic", "twist of lemon peel"], | |
"sweet": ["sugar cube", "spoonful of honey", "spash of cola"], | |
"fruity": ["slice of orange", "dash of cassis", "cherry on top"] | |
} | |
adjectives = ["Poopy", "Nasty", "Hairy", "Shiny", "Dapper"] | |
nouns = ["Person", "Flower", "Clothing", "Necktie"] | |
def bartend(): | |
flavors = {} | |
for preference, ask in questions.items(): | |
print(ask) | |
answer = str(input("")) | |
if answer[0] == "y" or answer[0] == "Y": | |
flavors.update({preference: True}) | |
else: | |
flavors.update({preference: False}) | |
return flavors | |
def makedrink(flavors): | |
drink = [] | |
for preference, bool_answer in flavors.items(): | |
if bool_answer == True: | |
drink.append(random.choice(ingredients[preference])) | |
return drink | |
def makename(): | |
name = random.choice(adjectives) + " " + random.choice(nouns) | |
return name | |
def main(): | |
answer = "y" | |
while answer[0] == "y" or answer[0] == "Y": | |
flavors = bartend() | |
drink = makedrink(flavors) | |
name = makename() | |
print("The", name, "made with ", drink) | |
answer = str(input("Would ye like me to make another drink? (Yes or No) ")) | |
print("Ok!") | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you're unsure whether the input data is in the proper case (lowercase or uppercase), you can just normalize the string -- convert it to the one you're expecting!