Skip to content

Instantly share code, notes, and snippets.

@KustomApe
Created November 23, 2016 17:12
Show Gist options
  • Save KustomApe/fcfd68161e3eb5b701a846659b29664c to your computer and use it in GitHub Desktop.
Save KustomApe/fcfd68161e3eb5b701a846659b29664c to your computer and use it in GitHub Desktop.
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"],
}
preferences = {}
def askingMachine():
for question in questions:
if input(questions.get(question) + "\n") in ['y', 'yes']:
preferences[question] = True
else:
preferences[question] = False
def drinkBuilder(preferences):
for ingredient in ingredients:
if preferences[ingredient] == True:
print(random.choice(ingredients.get(ingredient)))
if __name__ == '__main__':
while input("Do you want a drink?\n") in ['y', 'yes']:
askingMachine()
drinkBuilder(preferences)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment