Learn Python 011: while loop

from random import choice

questions = ['Why is the sky blue? ',
             'Why do cats have 4 legs? ',
             'Why is the summer hot? ']

question = choice(questions)

answer = input(question).lower().strip()

while answer != 'just because':
    answer = input('Why? ').lower().strip()

print('Oh... Okay, I understand now.')

 

posted @ 2017-07-16 16:41  mxyzptlk  阅读(142)  评论(0)    收藏  举报