Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Reverse Numbers Program

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Reverse Numbers Program. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

An Intelliswift Software utility needs to display a sequence of integers in reverse order. Given two integers start and end, return all numbers from end down to start, including both endpoints.

Implement the function using a loop or equivalent iteration. The input range is guaranteed to be valid, so start will not be greater than end.

Formal Specification

  • Input: Two integers, start and end.
  • Output: A list of integers ordered from end to start.
  • Inclusion: Both boundary values must appear in the result.

Constraints

  • -10^6 <= start <= end <= 10^6
  • The output contains exactly end - start + 1 values.
  • Both start and end must be included.

Function Signature

def reverse_range(start, end):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output