True or False question

This functionality allows to ask a true/false type of question. It requires a question and the solution as a True/False value. Optionally, the texts for success, error and button can be customized.

true_or_false(question, answer, success='Correct answer', error='Wrong answer', button='Check answer')

Renders a true or false question from arguments.

Parameters:
  • question (str) – question to be displayed before the true or false options

  • answer (str) – expected answer to the question, can be True or False

  • success (str, optional) – message to be displayed when the user answers correctly. If empty, no message is displayed.

  • error (str, optional) – message to be displayed when the user answers incorrectly. If empty, no message is displayed.

  • button (str, optional) – message to be displayed on the button that checks the answer

Returns:

tuple of booleans(button_pressed, answer_correct) with the button status and correctness of answer

Return type:

tuple of bool