Answer the question
In order to leave comments, you need to log in
How to set numbers in descending order in a loop?
There is this code:
numbers = ['324', '1002', '6', '8', '921']
text = ''
a = 0
for i in range(len(numbers)):
text += f"{a + 1}. {numbers[i]}\n"
a += 1
print(f"Числа от большого к маленькому\n\n{text}")
Answer the question
In order to leave comments, you need to log in
print('\n'.join(f'{i}. {n}' for i, n in enumerate(sorted(numbers, key=int, reverse=True), 1)))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question