Kratzer -Lotterie -FunktionPython

Python-Programme
Anonymous
 Kratzer -Lotterie -Funktion

Post by Anonymous »

Ich arbeite an einem Scratch Lottery -Befehl in meinem Python -Spiel.def lottery(player_money):
print('scratch lottery :')
print('price: 500')
print('wins :')
print(' all 6 same : $100000')
print(' all 5 same : $50000')
print(' all 4 same : $10000')
print(' all 3 same : $1000')
print(' all 2 same : $300')
print('do you want to buy it?? yes/no')
buy = input('> ')
if buy == 'no':
print('please come back later!!')
return player_money
elif buy == 'yes':
print('_____________')
lottery_results = ['x', 'o', 'p', 'k', 'm', 'e', 'a', 'w']
a = random.choice(lottery_results)
b = random.choice(lottery_results)
c = random.choice(lottery_results)
d = random.choice(lottery_results)
e = random.choice(lottery_results)
f = random.choice(lottery_results)
print('| ' + a + ' | ' + b + ' | ' + c + ' |')
print('|_' + d + '_|_' + e + '_|_' + f + '_|')
if...
< /code>
Ich habe keine Ahnung, was ich nach < /p>
setzen sollif...
< /code>
Ich möchte nicht machen, wenn für alle möglichen Lösungen, da dies 2 Millionen IFs wäre. < /p>
Ich möchte es unten machen < /p>
If 2 of the str in a or b or c or d or e or f is the same:
print('Since 2 matched, you won $300!')
player_money += 300
return player_money
< /code>
Ich weiß nicht, wie man den Ausdruck codiert (ify), der nach und nach der Phrase nachgeht, wenn das nicht funktioniert, und es würde einen Fehler geben < /p>
Irgendwelche Vorschläge, wie ich diese Funktionsweise machen könnte? < /p>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post