Python Math: Reverse a range
71. Reverse a Range
Write a Python program to reverse a range.
Sample Solution:
Python Code:
Sample Output:
range(9, -1, -2) range(4, 0, -1)
Flowchart:

For more Practice: Solve these Related Problems:
- Write a Python program to reverse a range of numbers using slicing and print the reversed sequence.
- Write a Python function that accepts a range object, reverses it, and returns the reversed range as a list.
- Write a Python script to reverse a range with a specified step and then output the resulting list of numbers.
- Write a Python program to implement a loop that manually reverses the elements of a given range and prints the final sequence.
Go to:
Previous: Write a Python program for casino simulation.
Next: Write a Python program to create a range for floating numbers.
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.