Find All Prime Numbers
Tags: Basics
Credit: CodingChallenge
Difficulty: Beginner
Type: Text
Category: Practice
Time Allowed: 5 s
Description:
Write a function that takes two integers: start
and an end
(interval definition, exclusive) and returns all identified prime numbers
in a list
. You should create a helper function to perform the primality check. This problem is designed to help you practice creating and calling custom functions
. The helper function should accept one parameter and return a boolean value.
Constraints:
- The input will be positive
integers
greater than 0. - The helper function should
return
aboolean
value:True
orFalse
. - You should use the provided helper function.
Example:
- Input:
[1, 10]
- Output:
[2, 3, 5, 7]
Test Case | Input | Expected Output |
---|---|---|
1 | [1, 10] | [2, 3, 5, 7] |
2 | [1, 20] | [2, 3, 5, 7, 11, 13, 17, 19] |
3 | [10, 20] | [11, 13, 17, 19] |
Leave a Comment
Please login to leave a comment.