N
N
N0_vich0k2020-02-14 16:55:25
Bots
N0_vich0k, 2020-02-14 16:55:25

How to write in VK with the implementation of a quiz in python?

Example: the user writes a certain word to the bot, after which the bot starts sending questions. The bot sent the first question: conditionally 4 buttons with answer options appear, if the user clicked on the wrong answer, then the bot writes that the answer is wrong and remembers this error, then the keyboard with answer options appears again, if the user answers correctly, then the bot asks the next question . This will continue until the user clicks on the button - "finish", after which the bot writes how many were correct answers, and how many were wrong.
Tell me how to do it?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yung_Cod3r, 2020-02-16
@Yung_Cod3r

As the easiest option, I can suggest you create variables (for example, GoodAnswers and BadAnswers) initially they = 0.
If the button with the correct answer is pressed, then we add +=1 to GoodAnswers and display the next question. If the button with the wrong answer is pressed, we add +=1 to BadAnswers and display the same question. When the player clicks Finish. We output a message like this:

"Игра окончена! \n Правильных ответов: " + str(GoodAnswers) + "Неправильных ответов: " + str(BadAnswers)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question