Answer the question
In order to leave comments, you need to log in
How to display in one message, for example, 5 different words from one list so that they do not repeat?
Is it possible?
I'm making a bot on Telebot.
Thanks in advance!
Answer the question
In order to leave comments, you need to log in
Try it:
l = ['hello', 'hello', 'world', 'foo', 'foo', 'bar']# Этот список дан для теста
out = []
for i, elem in set(l):
if i >= 5: # Вместо пяти ваше число
out.append(elem)
bot.send_message(message.from_user.id, *out)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question