feat: solved get_multiples in pre-algebra notebook

This commit is contained in:
rzmk 2023-09-20 22:56:05 -04:00
parent 186f76d4f7
commit 8ed5716a83
No known key found for this signature in database

View file

@ -186,10 +186,20 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": []
"source": [
"def get_multiples(n: int, l: int) -> set:\n",
" multiples = set()\n",
" for num in range(n, l + 1):\n",
" if num % n == 0:\n",
" multiples.add(num)\n",
" return multiples\n",
"\n",
"assert get_multiples(3, 20) == {3, 6, 9, 12, 15, 18}\n",
"assert get_multiples(5, 50) == {5, 10, 15, 20, 25, 30, 35, 40, 45, 50}"
]
}
],
"metadata": {