try: me.has_answer(question) except AnswerNotFound: me.learn(question.topic) else: me.coffee() finally: me.answer(question)