mirror of
https://github.com/rzmk/ladderz.git
synced 2025-12-19 06:59:25 +00:00
feat: use add method for get_multiples_in_range, simplify docs + no fn main
This commit is contained in:
parent
03c12af93f
commit
6bbf891052
3 changed files with 35 additions and 114 deletions
|
|
@ -186,15 +186,14 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def get_multiples_in_range(n: int, end: int) -> set:\n",
|
||||
" multiples = set()\n",
|
||||
" for num in range(n, end + 1):\n",
|
||||
" if num % n == 0:\n",
|
||||
" multiples.add(num)\n",
|
||||
" for num in range(n, end + 1, n):\n",
|
||||
" multiples.add(num)\n",
|
||||
" return multiples\n",
|
||||
"\n",
|
||||
"assert get_multiples_in_range(3, 20) == {3, 6, 9, 12, 15, 18}\n",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue