link: https://www.codecademy.com/practice/projects/games-of-chance

sorry to be back on the forum asking another question so soon, but here it is…

```
def cho_han(guess, amount):
roll1 = random.randint(1,6)
roll2 = random.randint(1,6)
roll_total = roll1 + roll2
even_numbers = [2, 4, 6, 8, 10, 12]
odd_numbers = [1, 3, 5, 7, 9, 11]
if (roll1 + roll2 == even_numbers) and (guess == "Even"):
result = "win"
final_amount = money + amount
elif (roll1 + roll2 == odd_numbers) and (guess == "Odd"):
result = "win"
final_amount = money + amount
else:
result = "lose"
final_amount = money - amount
print(
"Your rolls were %.f and %.f for a total of %.f. Since you guessed %s, you %s and now have $%.2f"
%(roll1, roll2, roll_total, guess, result, final_amount)
)
return final_amount
```

When running the game, it will always give the result that you have lost no matter if your guess of “Even” or “Odd”. This leads me to believe that both of my if & elif statements are auto failing and the default through the else statement is to just say you lose.

I have never done a number array before in python and figured I would try something like that here just to save time when checking if the resulting die toss is even or odd. I assume that is where I am going wrong here? Can someone tell me how to correct it?

1 Like

If you think the condition is wrong then you may want to confirm that by looking at the input of the condition and the outcome.

Keep narrowing it down until you know which exact operation isn’t behaving like you want it to. You’re using 4 operators in your condition, that can be broken into smaller pieces too, there’s no reason to look at more than one of them at a time.

@jacobgarwin295317990, we call them *lists* in Python-land. Take a few minutes to go through **this page**. The information you need is there.

1 Like

Thanks for the informative link! So I see that the key here is the “==” operator cannot be used for comparing numbers within the list and instead the correct syntax would be replacing it with “in”.

1 Like

If you think of operators as regular functions, maybe that makes more sense to you? Is a number equal to a list? It’s not even the same shape/kind/type. – forget about syntax, it’s the meaning of the things that’s important

Yes, exactly! **in** is one of Python’s most powerful tools.

If you wish to know my thinking on this, I thought I could extrapolate the == operator to a list of numbers. I simply guessed that doing so would have compared the result of (roll1 + roll2) to each number within the list and if that number was present it would return “True”.

Clearly that guess was incorrect but I don’t believe it to be an illogical one. I started learning python yesterday so forgive me for making a mistake that may seem remedial to you…