Multiple choice question

This functionality allows to ask a multiple choice question. It requires a question, the alternatives and the answer(s). Optionally, the texts for success, error and button can be customized.

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

Render a multiple choice question from the given parameters.

Parameters:
  • question (str) – question to be displayed before the multiple-choice options

  • options_dict – dictionary of options to be displayed, with the option text as key and the boolean answer as value

  • answer (int) – index (starting at 0) of the expected answer to the question

  • success (str, optional) – message to be displayed when the user answers correctly

  • error (str, optional) – message to be displayed when the user answers incorrectly

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

Returns:

tuple of booleans with button press status and correctness of answer

Return type:

tuple of bool