Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import telebot
- import random
- bot = telebot.TeleBot('TOKEN')
- @bot.message_handler(commands=['start'])
- def welcome_start(message):
- bot.send_message(message.chat.id, 'Угадай число от 0 до 10!' '\n'
- 'Какое число?')
- a = (random.randint(0, 10))
- @bot.message_handler(content_types=['text'])
- def text(message):
- if int(message.text) == a:
- bot.send_message(message.chat.id, 'Верно!')
- a = (random.randint(0, 10))
- elif int(message.text) > a:
- bot.send_message(message.chat.id, 'Меньше!')
- elif int(message.text) < a:
- bot.send_message(message.chat.id, 'Больше!')
- bot.polling()
Add Comment
Please, Sign In to add comment