Answer the question
In order to leave comments, you need to log in
How to concatenate names with sorted numbers?
There is this code:
numbers = ['324', '1002', '6', '921']
users = ['Дмитрий', 'Анатолий', 'Василий', 'Никита']
# То есть, у Дмитрия число 324, у Анатолия 1002 и т. д.
top = '\n'.join([ f"{i + 1}. {users[i]} {b}" for i, b in enumerate(sorted(map(int, numbers), reverse=True)) ])
print(f"Топ пользователей:\n\n{top}")
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question