mirror of
https://github.com/rzmk/ladderz.git
synced 2025-12-19 06:59:25 +00:00
fix: rename variables for get_primes_in_range
This commit is contained in:
parent
466af4ca4c
commit
8c2cb91093
1 changed files with 5 additions and 5 deletions
|
|
@ -284,11 +284,11 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"**Write a program that finds all prime numbers of a positive integer `n` in the range `[n, end]`.**\n",
|
||||
"**Write a program that finds all prime numbers of a positive integer `n` in the range `[start, n]`.**\n",
|
||||
"\n",
|
||||
"- Assume that `n` and `end` are positive integers greater than or equal to 1.\n",
|
||||
"- Assume that `start` and `n` are positive integers greater than or equal to 1.\n",
|
||||
"\n",
|
||||
"For example for `n = 1` and `end = 20`, the output of `get_primes_in_range(1, 20)` may be:\n",
|
||||
"For example for `start = 1` and `n = 20`, the output of `get_primes_in_range(1, 20)` may be:\n",
|
||||
"\n",
|
||||
"```\n",
|
||||
"{2, 3, 5, 7, 11, 13, 17, 19}\n",
|
||||
|
|
@ -301,9 +301,9 @@
|
|||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def get_primes_in_range(n: int, end: int) -> set:\n",
|
||||
"def get_primes_in_range(start: int, n: int) -> set:\n",
|
||||
" primes: set = set()\n",
|
||||
" for num in range(n, end + 1):\n",
|
||||
" for num in range(start, n + 1):\n",
|
||||
" if is_prime(num):\n",
|
||||
" primes.add(num)\n",
|
||||
" return primes\n",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue