mirror of
https://github.com/rzmk/ladderz.git
synced 2025-12-19 06:59:25 +00:00
feat: solved get_multiples in pre-algebra notebook
This commit is contained in:
parent
186f76d4f7
commit
8ed5716a83
1 changed files with 12 additions and 2 deletions
|
|
@ -186,10 +186,20 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 5,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"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": {
|
"metadata": {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue