我正在尝试制作故障排除系统,但是会出现错误,说明问题未定义。我该如何纠正?我还可以继续使用我用来添加更多问题和答案的数组,例如第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")
答案 0 :(得分:3)
issue
未定义,因为您将用户在problem
而非issue
内输入的内容与该行放在一起时犯了一个小错误:problem = raw_input("Type the problem with the phone:")