lundi 23 septembre 2019

Python printing only "Even! You lost $300" and nothing else

import random

dice1 = random.randint(1, 6)
dice2 = random.randint(1, 6)
print(dice1, dice2)

user_in = "Odd"
odd = [1, 3, 5, 7, 9, 11]
even = [2, 4, 6, 8, 10, 12]

def cho_han(dice1, dice2, money1, user_in):
  if (dice1 + dice2 == odd) and user_input == "Odd":
    return "Odd! You Won $" + str(money1 * 2)
  elif (dice1 + dice2 == odd) and user_in != "Odd":
    return "Odd! You lost $" + str(money1)
  elif (dice1 + dice2 == even) and user_in == "Even":
    return "Even! You Won $" + str(money1 * 2)
  else:
    return "Even! You lost $" + str(money1)

print(cho_han(dice1, dice2, 300, user_in))

No matter what I put in for the variable user_in it will always print "Even! You lost $300" Sorry for having such a minor problem I'm new to python and programming in general and am just trying to learn.

Thanks for anyone who can help!

Aucun commentaire:

Enregistrer un commentaire