From 8ed5716a83b4f2b2826947af30c0c4c71da14d83 Mon Sep 17 00:00:00 2001 From: rzmk Date: Wed, 20 Sep 2023 22:56:05 -0400 Subject: [PATCH] feat: solved get_multiples in pre-algebra notebook --- notebooks/pre-algebra/unit1.ipynb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/notebooks/pre-algebra/unit1.ipynb b/notebooks/pre-algebra/unit1.ipynb index 1fd5f29..6460825 100644 --- a/notebooks/pre-algebra/unit1.ipynb +++ b/notebooks/pre-algebra/unit1.ipynb @@ -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": {