-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.py
More file actions
48 lines (42 loc) · 2.8 KB
/
script.py
File metadata and controls
48 lines (42 loc) · 2.8 KB
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
def get_emotional_state_response(emotional_state):
"""
Provides a response based on the user's reported emotional state.
Args:
emotional_state: An integer between 1 and 10 representing the user's
emotional state, with 1 being very sad and 10 being ecstatic.
Returns:
A string containing the appropriate response.
"""
if emotional_state == 1:
return "If you are feeling suicidal, please call or text the 988 Suicide & Crisis Lifeline. You are not alone, and help is available 24/7."
elif 2 <= emotional_state <= 6:
responses = [
"It sounds like you're going through a tough time. Remember to practice self-compassion. Try to identify and challenge negative thoughts. Focus on the positive aspects of your life, even the small ones. You are stronger than you think.",
"Remember that feelings are temporary. Take some deep breaths and try to focus on what you can control. Consider writing down three things you're grateful for today.",
"It's okay to not be okay. Try to reframe negative thoughts by asking yourself if there's another way to look at the situation. You've overcome challenges before, and you can do it again.",
"You are worthy of happiness and peace. Practice mindfulness by focusing on the present moment. Even small steps towards positive change can make a difference.",
"Allow yourself to feel your emotions without judgment. Consider engaging in a relaxing activity like listening to music or going for a walk. Remember that you are not defined by your current feelings."
]
return responses[(emotional_state - 2) % len(responses)] #cycle through the responses
elif 7 <= emotional_state <= 9:
responses = [
"Congratulations on feeling this way! Keep nurturing your positive mental health. Remember to practice gratitude and self-care.",
"That's wonderful! Continue to focus on positive activities and relationships. You're on the right track!",
"Excellent! Keep up the great work in maintaining your emotional well-being. Remember the strategies that have been working for you."
]
return responses[(emotional_state - 7) % len(responses)] #cycle through the responses
elif emotional_state == 10:
return "Well, that's just wonderful!"
else:
return "Please enter a number between 1 and 10."
def main():
while True:
try:
user_input = int(input("On a scale of 1 to 10, with 1 being very sad and 10 being ecstatic, how are you feeling? "))
response = get_emotional_state_response(user_input)
print(response)
break
except ValueError:
print("Invalid input. Please enter a number.")
if __name__ == "__main__":
main()