Find Even Numbers
Find Even Numbers
Tags: Loops Basics
Credit: CodingChallenge
Difficulty: Beginner
Type: Text
Category: Practice
Time Allowed: 5 s
Description:
Write a function that takes two integers, start and end, and returns a list of all even numbers between start and end (inclusive). This problem is designed to help you practice using for loops and conditionals
. The function should accept two parameters and return the list of even numbers.
Constraints:
- The start and end inputs will be
integers
. - The start can be less than or equal to end.
- The function should
return
alist
of even numbers between start and end inclusive.
Example:
- Input:
1, 10
- Output:
[2, 4, 6, 8, 10]
Test Case | Input | Expected Output |
---|---|---|
1 | [1, 10] | [2, 4, 6, 8, 10] |
2 | [2, 5] | [2, 4] |
3 | [7, 7] | [] |
4 | [10, 20] | [10, 12, 14, 16, 18, 20] |
5 | [5, 3] | [] |
Leave a Comment
Please login to leave a comment.