parent
3ef372196c
commit
e67e21e955
|
@ -85,17 +85,17 @@
|
|||
print('你的总资产为:', money)
|
||||
needs_go_on = False
|
||||
while True:
|
||||
debt = int(input('请下注: '))
|
||||
if 0 < debt <= money:
|
||||
bet = int(input('请下注: '))
|
||||
if 0 < bet <= money:
|
||||
break
|
||||
first = randint(1, 6) + randint(1, 6)
|
||||
print('玩家摇出了%d点' % first)
|
||||
if first == 7 or first == 11:
|
||||
print('玩家胜!')
|
||||
money += debt
|
||||
money += bet
|
||||
elif first == 2 or first == 3 or first == 12:
|
||||
print('庄家胜!')
|
||||
money -= debt
|
||||
money -= bet
|
||||
else:
|
||||
needs_go_on = True
|
||||
while needs_go_on:
|
||||
|
@ -104,10 +104,10 @@
|
|||
print('玩家摇出了%d点' % current)
|
||||
if current == 7:
|
||||
print('庄家胜')
|
||||
money -= debt
|
||||
money -= bet
|
||||
elif current == first:
|
||||
print('玩家胜')
|
||||
money += debt
|
||||
money += bet
|
||||
else:
|
||||
needs_go_on = True
|
||||
print('你破产了, 游戏结束!')
|
||||
|
@ -127,4 +127,4 @@
|
|||
|
||||
> **说明**:素数指的是只能被1和自身整除的正整数(不包括1)。
|
||||
|
||||
上面练习的参考答案在本章对应的代码目录中,如果需要帮助请读者自行查看参考答案。
|
||||
上面练习的参考答案在本章对应的代码目录中,如果需要帮助请读者自行查看参考答案。
|
||||
|
|
Loading…
Reference in New Issue