For python3, I am stuck on how to determine and write the if statements that wil
ID: 3761674 • Letter: F
Question
For python3, I am stuck on how to determine and write the if statements that will distinguish if one, two or three, of the selected input was rolled. I have for the setup:
def dice_bet(d1, d2, d3, wager):
bet = int(input("Pick a number for your bet (1 to 6)"))
while bet<1 or bet>6:
print(bet, "is not a valid choice. Please, enter a valid choice.")
bet = int(input("Pick a number for your bet (1 to 6)"))
"1. Single Die Bet - Player bets that a specific number will appear. If all three dice are the number selected, the player receives 10 times their original bet. If two dice are the number, the player receives twice their original bet. If one die is the number, player receives their original bet. Otherwise, the player loses their bet."
Explanation / Answer
def dice_bet(d1, d2, d3, wager):
bet = 0
while True:
bet = int(input("Pick a number for your bet (1 to 6)"))
if bet<1 or bet>6:
print(bet, "isnot a valid choice. Please, enter a valid choice.")
else:
break
count = 0
if bet==d1:
count = count+1
if bet==d2:
count = count+1
if bet==d3:
count = count+1
if count == 3:
print 'Recieves 3 times the original bet'
elif count == 2:
print 'Recieves 2 times the original bet'
elif count == 1:
print 'Recieves the original bet'
else:
print 'loses the original bet'
dice_bet(2,3,2,'aa')
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.