petname = ['Zophie', 'Pooka', 'Fat-tail'];\
print ('what is your pets name?');\
name = input();\
if name not in petname:;\
我上面的代码出现语法错误?有人可以帮忙吗
答案 0 :(得分:1)
你需要这样做,如果我认为这是你的目的是正确的:
petname = ['Zophie', 'Pooka', 'Fat-tail']
print ('What is your pets name?')
name = input()
if name not in petname:
print ('Your pet is not in the list')
else:
print ('Your pet is in the list')