函数被读作变量并在Python中工作

时间:2018-05-22 12:48:40

标签: python recursion

我希望在python中有一个函数recur,但是当我自己调用该函数时,它会将其作为变量读取,从而打破游戏。这是重要的代码。

def City(WCity):
    if WCity == "v":
        print sty.BOLD + "WELCOME DO VIRIDIAN CITY" + sty.END
        print "What would you like to do?"
        print "Press 0 to look around"
        print "Press 1 to Go to the pokemon center"
        print "Press 2 to Go to the PokeMart"
        print "Press 3 to go back"
        print "Press 4 to go foward"
        PlayerChoice = int(input())
        if PlayerChoice == 0:
            CP.Viridian()
            City(WCity)
        if PlayerChoice == 1:
            print "Welcome to the Pokemon Center, please wait while we heal your pokemon to full health"
            for i in xrange(0,len(Player.Pokemon)):
                Player.Pokemon[i].HP = Player.Pokemon[i].MaxHP
            time.sleep(2)
            print "Your Pokemon's health was restored"
            time.sleep(.5)
            City(WCity)    

0 个答案:

没有答案