python中name没有定义_Python;NameError:未定义名称“handsum”

我正在编写一个基本的21点游戏,我挑战自己尽可能多地编写函数,代码如下所示:funcA() funcB() funcC() 与之相反的是: ^{pr2}$ 以

我正在编写一个基本的21点游戏,我挑战自己尽可能多地编写函数,代码如下所示:funcA()

funcB()

funcC()

与之相反的是:

^{pr2}$

以下是我的代码中存在的问题:def playerTurn():

global handSum

global cardOne

global cardTwo

global dealerSum

global upCard

global downCard

global bet

global newCard

global dealerNewCard

str(handsum)

str(cardOne)

str(cardTwo)

str(upCard)

str(money)

print("You are lying at", handSum, "with a", cardOne, 'and a', cardTwo

+ '.', "The Dealer has a", upCard, "facing up. You have $" + money + '.')

int(handsum)

int(cardOne)

str(cardTwo)

str(upCard)

str(money)

sleep(1.3)

bet=int(input('How much would you like to bet? '))

sleep(1.3)

money-=bet