如何定义一些东西?

时间:2016-10-22 21:23:00

标签: python python-2.7

我正在尝试制作故障排除系统,但是会出现错误,说明问题未定义。我该如何纠正?我还可以继续使用我用来添加更多问题和答案的数组,例如第4个可能是sound吗?

def troubleshooting():
    print("Welcome to my phone troubleshooting system...")

problem = raw_input("Type the problem with the phone:")

problem = ['cracked', 'crack', 'broken']

if problem[0] in issue:
    print("Replace screen")
elif problem[1] in issue:
    print("Replace screen")
elif problem[2] in issue:
    print("Replace phone")
else:
    print("Replace screen")

1 个答案:

答案 0 :(得分:3)

issue未定义,因为您将用户在problem而非issue内输入的内容与该行放在一起时犯了一个小错误:problem = raw_input("Type the problem with the phone:")