C
C
ch1ps012022-04-19 20:16:34
Telegram
ch1ps01, 2022-04-19 20:16:34

Telebot what to do?

a=random.randint(1,10)
b=random.randint(1,10)
c=a+b
sent=bot.send_message(message.chat.id, f'{a}+{b}')
bot.register_next_step_handler(sent, hello)

def hello(message):
    message_to_save = message.text
    global a, b, c
    if message.text==c:
        bot.send_message(message.chat.id, 'Верно')
    else:
        bot.send_message(message.chat.id, 'Неверный ответ')

2 numbers and their sum are created, then the first two numbers are displayed to the user, and if he correctly names their sum, then the bot should answer ok, but even if the answer is correct, he answers that the answer is wrong, what should I do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
t38c3j, 2022-04-20
@t38c3j

Set breakpoints and run the script in debug mode, then everything will immediately become clear)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question