2016-10-29 2 views
-2

나는 현재 '동물의 추측'게임을 만들고 있는데, 사용자가 질문을 입력하면 대답이 생성됩니다. 그러나, 나는 루프 동안 '이 질문은 인식되지 않습니다'만들려고 노력에 붙어있다.이 상황에서 "동안"을 어떻게 사용합니까?

while questionone.find("bird") or questionone.find("mammal") not in questionone: 
    print("This question isn't recognised.") 
    print("Ask another question or check for typos.") 
    print("This will not count towards your 5 questions.") 
    questionone = input("What is your question? ") 
    questionone = questionone.lower() 

어떻게 수정합니까? 모든 답변은 크게 감사하겠습니다.

답변

2

루프 조건은 당신이 사용할 수있는,

while 'bird' not in questionone and 'mammal' not in questionone: 

당신이에 대해 확인하고자하는 단어의 집합이 확장하는 것입니다

while not any(word in questionone for word in {'bird', 'mammal', 'etc'}: 
관련 문제