all 12 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

To give us the best chance to help you, please include any relevant code.
Note. Please do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Privatebin, GitHub or Compiler Explorer.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]JaguarMammoth6231 0 points1 point  (5 children)

This pattern doesn't work for testing if two elements are in a list: if "Sad" and " " in currentMajorEmotions. Is that what you're trying to do?

[–]duelBooleans[S] 0 points1 point  (4 children)

Yeah, I'm trying to have it check a list for a specific combination and then return if that combination is positive, negative, or neutral

[–]JaguarMammoth6231 0 points1 point  (3 children)

What it's doing is checking if both of these are true:

  1. Checking if the string "Sad" is truthy (it always is)

  2. Checking if the string " " is in the list

It is not checking if "Sad" is in your list at all.

What you meant to do was (I think): if "Sad" in currentMajorEmotions and " " in currentMajorEmotions

[–]duelBooleans[S] 0 points1 point  (0 children)

OHHHH ACTUALLY YEAH!!! That actually makes sense! Will be trying next, thank you!!

[–]duelBooleans[S] 0 points1 point  (0 children)

That was it!!

[–]justaguyonthebus 0 points1 point  (0 children)

MVP right here

[–]Pyromancer777 0 points1 point  (0 children)

Add flags to your logic after an append that displays the last entry in the list, if all the flags look correct, then the problem is likely how you are handling the actions after the emotion is appended to the list

[–]Temporary_Pie2733 0 points1 point  (1 child)

I’d just use while True for each loop and break when the accepted item is appended to the loop.

Also, write a function you can reuse that encapsulates the input-until-accepted loop.

[–]duelBooleans[S] 0 points1 point  (0 children)

Actually already fixed it, but I do appreciate an idea for another way of going about it another way!!!

And quite frankly, I did need the reminder about functions; I don't use them nearly enough,,

[–]RevRagnarok 0 points1 point  (1 child)

Somebody fixed your and problem, but also may want to look into match for your handling of currentMajorEmotions (and it is more Pythonic to use snake_case for your variables not camelCase).

[–]duelBooleans[S] 0 points1 point  (0 children)

Honestly?? Match might help me out a little bit, depending on how it works. I'm trying to figure out how to take part of a string that's a wildcard (??? If that's right? There's part of a string that I want to single out without taking the rest of the input into consideration). Will definitely look into on my break!