money=int(input("請輸入初始金額:"))
while money>0:
? ? print("你還有%s個(gè)金幣"%money)
guess=input("big or small:")
if guess!="big" and guess!="small":
? ? ? ? print("你輸入有誤纬凤,請重新輸入!")
continue
? ? # a為賭注? ? a=int(input("是否下賭注揍瑟?1為下粱挡,2為不下:"))
if a==1:
while True:
? ? ? ? ? ? wager=int(input("賭注為:"))
if wager>money:
? ? ? ? ? ? ? ? print("你的金額不足骗污,請重新下注旁理!")
else:
import random
num=random.randint(1,6)
print(num)
if?0<num<=3 and guess=="small" or 3<num<=6 and guess=="big":
print("you win!")
money+=wager
elif?0<num<=3 and guess=="big" or 3<num<=6 and guess=="small":
print("you lose!")
money-=wager
break
if a==2:
import random
num=random.randint(1, 6)
print(num)
if?0<num<=3 and guess=="small" or 3<num<=6 and guess=="big":
print("you win!")
money+=100
elif 0<num<=3 and guess=="big" or 3<num<=6 and guess=="small":
print("you lose!")
money-=100
print("game over")