questions
Questions interfaces for the OpenTriviaDB wrapper.
Question
dataclass
A question.
Attributes:
Name | Type | Description |
---|---|---|
category |
str
|
The question category. |
type |
str
|
The question type. |
difficulty |
str
|
The question difficulty. |
question |
str
|
The question body. |
correct_answer |
str
|
The question's correct answer. |
incorrect_answers |
list of str
|
A list of the question's incorrect answers. |
Source code in opentriviadb/questions.py
answer
Answer the question, and check if it is correct.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
option |
str
|
The option with which you wish to answer the question. |
required |
Returns:
Type | Description |
---|---|
bool
|
Whether you answered the question correctly. |
Source code in opentriviadb/questions.py
options
property
All the question options shuffled in a random order.
Returns:
Type | Description |
---|---|
list of str
|