2016-08-04 2 views
-5
petname = ['Zophie', 'Pooka', 'Fat-tail'];\ 
    print ('what is your pets name?');\ 
    name = input();\ 
    if name not in petname:;\ 

위의 코드에서 구문 오류가 발생합니까? 내가 생각하는 올바른 생각하면 사람이파이썬에서 구문 오류가 발생하는 경우

+1

하지 petname에서'경우 이름은 무엇인가,'어떻게해야? –

+0

그 후에 print 문을 써야합니다. 내가 입력 할 때 오류가 발생합니다. if 문은 입력 한 이름이 petname 목록에 없는지 확인하려고합니다. – BeginnerPython

+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') 
관련 문제