-
Notifications
You must be signed in to change notification settings - Fork 4
/
app.py
57 lines (42 loc) · 1.72 KB
/
app.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
print("Title of program: Happy bot")
print()
while True:
description = input("Could you describe how you feel in a sentence?")
list_of_words = description.split()
feelings_list = []
encouragement_list = []
counter = 0
for each_word in list_of_words:
if each_word == "miserable":
feelings_list.append("miserable")
encouragement_list.append("don't let yesterday's sadness bring you down. this too shall pass. stay positive!")
counter += 1
if each_word == "happy":
feelings_list.append("happy")
encouragement_list.append("that's awesome! stay happy and cheerful!")
counter += 1
if each_word == "tired":
feelings_list.append("tired")
encouragement_list.append("please do get some rest and sleep well.")
counter += 1
if each_word == "worried":
feelings_list.append("worried")
encouragement_list.append("don't worry, everything will go well!")
counter += 1
if counter == 0:
output = "Sorry I don't really understand. Please use different words?"
elif counter == 1:
output = "It seems that you are feeling quite " + feelings_list[0] + ". Even so, do remember that "+ encouragement_list[0] + "! Hope you feel better :)"
else:
feelings = ""
for i in range(len(feelings_list)-1):
feelings += feelings_list[i] + ", "
feelings += "and " + feelings_list[-1]
encouragement = ""
for j in range(len(encouragement_list)-1):
encouragement += encouragement_list[i] + ", "
encouragement += "and " + encouragement_list[-1]
output = "It seems that you are feeling quite " + feelings + ". Remember - "+ encouragement + "! Hope you feel better :)"
print()
print(output)
print()