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?