e-caste / reti-quiz

A script and a Telegram bot to help prepare the Computer Networks exam
https://t.me/networks_quiz_bot
GNU General Public License v3.0
2 stars 4 forks source link

Precompute questions, answers, and comments #9

Open e-caste opened 3 years ago

e-caste commented 3 years ago

To lift the weight of the computation needed to do the parsing after any question is requested to the bot, it would be simpler to keep all these data in memory after an initialization in a dict such as:

qacs: Dict[int, Dict[str, str]] = {
    1: {
       'q': 'This is a question',
       'a': 'C',
       'c': 'This is a comment'
    },
    ...
}