小编min*_*att的帖子

当我尝试运行这段代码时,我不断收到命名错误(Python)

class game_type(object):
    def __init__(self):
        select_game = raw_input("Do you want to start the game? ")
        if select_game.lower() == "yes":
            player1_title = raw_input("What is Player 1's title? ").lower().title()


class dice_roll(object,game_type):
    current_turn = 1
    current_player = [player1_title,player2_title]
    def __init__(self):
        while game_won == False and p1_playing == True and p2_playing == True: 
            if raw_input("Type 'Roll' to start your turn  %s" %current_player[current_turn]).lower() == "roll":
Run Code Online (Sandbox Code Playgroud)

我一直收到一条错误:NameError:名称'player1_title'未定义

我知道标题是一个函数,所以我尝试使用player1_name和player1_unam,但这些也返回相同的错误:(

有人可以帮忙吗

非常感谢所有答案

python class

1
推荐指数
1
解决办法
96
查看次数

使用启发式编程?

我能否对利用启发式方法的项目提出一些想法

预先感谢您的帮助

python vb.net heuristics

0
推荐指数
1
解决办法
4170
查看次数

标签 统计

python ×2

class ×1

heuristics ×1

vb.net ×1