S
S
svntxxnx2021-01-25 10:16:04
Python
svntxxnx, 2021-01-25 10:16:04

How to minus a variable in pytelegrambotapi?

Good day everyone!

I create a telegram bot and pytelegrambotapi

Almost did everything

There is a variable "balanc" and in it I put the number 10, in short it's like this: ballanc = 10

And I made this function for the bot

if call.data == 'four':
    if balanc <= 10:
         balanc - 10
         bot.answer_callback_query(call.id, "Ты купил кролика")
     elif balanc > 10:
          bot.answer_callback_query(call.id, "У вас не достаточно денег")


There is also a "personal account" button where I can see my balance. But even if I press the "four" button on the callback, the balance does not change. Why didn't they minus 10 from the balanc variable?

Thanks in advance

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
Bolide9, 2021-01-25
@svntxxnx

Not Abalanc - 10
balanc -= 10

D
Dr. Bacon, 2021-01-25
@bacon

Another "bot writer", you don't need to make bots, but learn the basics of python, and programming in general.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question