from PyInquirer import prompt widget = [ { 'type':'confirm', 'name':'ok', 'message':'Would you like to know the ultimate answer ?', 'default':True } ] result = prompt(widget) print('Your answer is') print(result["ok"]) if result["ok"]: print(42)