-
Notifications
You must be signed in to change notification settings - Fork 0
/
dictionary.py
63 lines (40 loc) · 1.44 KB
/
dictionary.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import random
import json
from pprint import pprint
dictalc = {}
#happiness, anger, sadness, contempt, disgust, fear, neutral, surprise
budget = 5
with open("alcohols.json") as file:
alcohols = json.load(file)
#HAPPINESS
if (emotion == "happiness"):
happinessDrinkDict = {**alcohols['Red Wine'], **alcohols['Beers']}
lst = []
for drink in happinessDrinkDict.keys():
if float(happinessDrinkDict[drink]) <= float(budget):
lst.append((drink,happinessDrinkDict[drink]))
happyChoice = lst[random.randint(0,len(lst)-1)]
#NEUTRAL
if(emotion == "neutral"):
neutralDrinkDict = {**alcohols['Vodka']}
neutralList = []
for drink in neutralDrinkDict.keys():
if float(neutralDrinkDict[drink]) <= float(budget):
neutralList.append((drink, neutralDrinkDict[drink]))
neutralChoice = neutralList[random.randint(0,len(neutralList)-1)]
#ANGER
elif(emotion == "anger"):
angerDrinkDict = {**alcohols['White Wine']}
angerList = []
for drink in angerDrinkDict.keys():
if float(angerDrinkDict[drink]) <= float(budget):
angerList.append((drink, angerDrinkDict[drink]))
angerChoice = angerList[random.randint(0,len(angerList)-1)]
#SADNESS
elif(emotion == "sadness"):
sadnessDrinkDict = {**alcohols['White Wine']}
sadnessList = []
for drink in sadnessDrinkDict.keys():
if float(sadnessDrinkDict[drink]) <= float(budget):
sadnessList.append((drink, sadnessDrinkDict[drink]))
sadnessChoice = sadnessList[random.randint(0,len(sadnessList)-1)]