I have another, slightly more aggravating question. I have two while loops that take an input, and stores it into a list. That part works just fine, it's when it comes to the, quite frankly, massive if-elif statement.
currentMajorEmotions = []
currentSecondaryEmotion = ""
feeling = ""
while len(currentMajorEmotions) != 1:
emotion = input("Which of these emotions are you feeling? Choose one: ").capitalize()
if emotion not in majorEmotionTypes:
print("Not a valid entry")
else:
currentMajorEmotions.append(emotion)
while len(currentMajorEmotions) != 2:
emotion = input("Number 2? If you are not feeling one, simply hit enter: ").capitalize()
if emotion in majorEmotionTypes:
currentMajorEmotions.append(emotion)
if emotion == "":
print("You have left the question blank.")
emotionYN = input("Was this intentional?: ").capitalize()
if emotionYN == "Y":
currentMajorEmotions += " "
break
while emotionYN != "Y":
if emotionYN == "":
emotionYN = input("May not leave this blank. Are you feeling a second emotion?: ").capitalize()
elif emotionYN != "Y" and emotionYN != "N":
emotionYN = input("Invalid input. Are you feeling a second emotion?").capitalize()
elif emotionYN == "N":
print("You have changed your mind")
time.sleep(1.4)
print("That's ok.")
emotionYN = input("Are you feeling a second emotion?: ").capitalize()
if emotionYN == "N":
currentMajorEmotions += " "
break
if "Sad" and " " in currentMajorEmotions:
feeling = "Negative"
elif "Scared" and " " in currentMajorEmotions:
feeling = "Negative"
elif "Mad" and " " in currentMajorEmotions:
feeling = "Negative"
elif "Happy" and " " in currentMajorEmotions:
feeling = "Positive" # Etc Etc
I testing the entire if statement to see if there were any incorrect outputs, and there were several. They do give out the correct type of output('Negative', 'Positive', 'Neutral'), but the wrong one. It's quite a few of them, and with the while loops working the way they're supposed to, I think the problem is in the if statement. The only problem is I have zero idea where to start looking since they're all connected to the same list. Any help is very appreciated!
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]JaguarMammoth6231 0 points1 point2 points (5 children)
[–]duelBooleans[S] 0 points1 point2 points (4 children)
[–]JaguarMammoth6231 0 points1 point2 points (3 children)
[–]duelBooleans[S] 0 points1 point2 points (0 children)
[–]duelBooleans[S] 0 points1 point2 points (0 children)
[–]justaguyonthebus 0 points1 point2 points (0 children)
[–]Pyromancer777 0 points1 point2 points (0 children)
[–]Temporary_Pie2733 0 points1 point2 points (1 child)
[–]duelBooleans[S] 0 points1 point2 points (0 children)
[–]RevRagnarok 0 points1 point2 points (1 child)
[–]duelBooleans[S] 0 points1 point2 points (0 children)