Here is my code. It is a pretty simple piece that changes the values of the first, second and third letter snippets depending on whether the user answers yes or no to the questions. For some reason I keep on getting errors that my letter values are not defined. Please let me know how to fix this issue.
code:
import webbrowser as wb
question1 = input("Do you like to go out with others?")
question2 = input("Are you a relatively happy person?")
question3 = input("Are you often sad?")
question4 = input("Would you say you live better than most people?")
def personality_test():
first_letter = 0
second_letter = 0
third_letter = 0
if question1 == "Yes":
first_letter = 2
if question1 == "yes":
first_letter = 2
if question1 == "No":
first_letter = 1
if question1 == "no":
first_letter = 1
if question2 == "Yes":
second_letter = 2
if question4 == "Yes":
third_letter = 2
if question4 == "yes":
third_letter = 2
if question2 == "yes":
second_letter = 2
if question4 == "Yes":
third_letter = 2
if question4 == "yes":
third_letter = 2
else:
if question3 == "yes":
print("Please contact this link. I hope you will be alright.")
wb.open("https://suicidepreventionlifeline.org/")
if question3 == "Yes":
print("Please contact this link. I hope you will be alright.")
wb.open("https://suicidepreventionlifeline.org/")
personality_result = (first_letter + second_letter + third_letter)
personality_test()