Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Even Numbers From Range

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

Your question is Even Numbers From Range. 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

For a utility in Hexaware Technologies engineering workflows, implement a function that returns all even integers within a specified inclusive range.

Given two integers start and end, return the even numbers from start through end, including either boundary when it is even. The range may be ascending or descending. Preserve the direction of the input range in the returned list.

Formal Specification

  • Input: Two integers, start and end.
  • Output: A list of integers containing every even number in the inclusive range from start to end.
  • If start <= end, return values in ascending order.
  • If start > end, return values in descending order.
  • An even integer is divisible by 2 with remainder 0.

Constraints

  • -10^6 <= start, end <= 10^6
  • start and end are integers
  • The range is inclusive
  • Return values in the same direction as the input range

Function Signature

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