我试图打破循环说
if deff <= int(total):
break
但是无论输入为负数还是大于总和,循环都会中断,它将中断循环
关于我做错了什么的任何建议?
PS我知道我会新的一个公式来决定玩家是赢还是输。现在我只是想在去那里之前弄清楚第一个代码
第一次编程,老师没有帮助):
def intro():
greeting()
print('How much money do you want to start with?')
print('Enter the starting amount of dollars.', end='')
total = int(input())
print('Your current total is '+ str(total)+'\n')
while True:
print('How much money do you want to bet (enter 0 to quit)?', end='');
# Bett will be the amount of money that the player will play with
bett = int(input())
if bett > int(total):
print('ERROR You don\'t have that much left')
if bett < int(0):
print('ERROR: Invalid bet amount\n')
if bett <= int(total)
break
# Function shows results of slot machine after handle being pulled
def random():
import random
num1 = random.randint(1, 5)
num2 = random.randint(1, 5)
num3 = random.randint(1, 5)
print('/---+---+---\ ')
print('|-'+ str (num1)+'-|-'+ str(num2) +'-|-'+ str (num3) +'-|')
print('\---+---+---/ ')
intro()