0

I'm trying to display a list in descending order:

answer = range(num1, num2, div)
print(reversed(list(answer)))

But my output is displaying <list_reverseiterator object at 0x000002385b687Fa0>.

How would I display my list in descending order?

For example:

[100, 90, 80, 70, 60, 50, 40, 30, 20, 10]
mkrieger1
  • 19,194
  • 5
  • 54
  • 65
jump
  • 17
  • 3
  • You need to convert the iterator to list `print(list(reversed(list(answer))))` – mozway Oct 26 '21 at 20:06
  • Although the linked answer is sufficient to answer your question, I wanted to add that if you want to generate the list using the `range()` function, you can simply use the function to generate the reversed list `range(num2, num1, -div)`. – Robin van Hoorn Oct 26 '21 at 20:20

0 Answers0