Бот округляющий числа не делает округления вверх
Бот может округлять только в меньшую сторону, а надо в обе Модуль: pyletelegrambotapi Изменила так, но все равно работает только в одну сторону(((
import time
import telebot
from telebot import types
import datetime
import math
bot = telebot.TeleBot('TOKEN')
@bot.message_handler(commands=['start'])
def start_menu(message):
bot.send_message(message.chat.id, text='Приветствую, для узнавания даты используйте /date,'
'для округления вниз /down, а вверх /up ')
@bot.message_handler(commands=['date'])
def date(message):
bot.send_message(message.chat.id, text=str(datetime.datetime.now())[0:19])
@bot.message_handler(commands=['down'])
def down(message):
bot.send_message(message.chat.id, text='Введите число, которое хотите округлить')
@bot.message_handler(content_types=['text'])
def down(message):
bot.send_message(message.chat.id, math.floor(float(message.text)))
@bot.message_handler(commands=['up'])
def up(message):
bot.send_message(message.chat.id, text='Введите число, которое хотите округлить !')
@bot.message_handler(content_types=['text'])
def up(message):
bot.send_message(message.chat.id, math.ceil(float(message.text)))
bot.polling(non_stop=True)