feat: use add method for get_multiples_in_range, simplify docs + no fn main

This commit is contained in:
rzmk 2023-09-22 10:16:17 -04:00
parent 03c12af93f
commit 6bbf891052
No known key found for this signature in database
3 changed files with 35 additions and 114 deletions

View file

@ -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",