From 9fdd713be3f60d7f5b645d4b20e8486d6e15d3a7 Mon Sep 17 00:00:00 2001 From: Reka67 Date: Mon, 26 Oct 2020 13:23:40 +0100 Subject: [PATCH] review needed --- your-code/main.ipynb | 105 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 94 insertions(+), 11 deletions(-) diff --git a/your-code/main.ipynb b/your-code/main.ipynb index 01257d4..66443f7 100755 --- a/your-code/main.ipynb +++ b/your-code/main.ipynb @@ -35,6 +35,16 @@ " " ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def modify_list(lst, lmbda=lambda x : for x in lst):\n", + " print(x)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -50,7 +60,7 @@ "metadata": {}, "outputs": [], "source": [ - "# your code here" + "convert = lambda x : x + 273.15" ] }, { @@ -62,7 +72,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -71,6 +81,24 @@ "# your code here" ] }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[285.15, 296.15, 311.15, 218.14999999999998, 297.15]\n" + ] + } + ], + "source": [ + "kelvin = list(map(lambda x: x + 273.15,temps))\n", + "print(kelvin)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -82,11 +110,31 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ - "# your code here" + "mod = lambda x,y : 1 if x % y == 0 else 0" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "mod(7,5)" ] }, { @@ -114,6 +162,17 @@ " # your code here" ] }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [], + "source": [ + "def divisor(b):\n", + " mod = lambda b,y : 1 if b % y == 0 else 0\n", + " return mod" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -123,11 +182,11 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 20, "metadata": {}, "outputs": [], "source": [ - "# your code here" + "divisible5=divisor(5)" ] }, { @@ -139,18 +198,42 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "metadata": {}, - "outputs": [], + "outputs": [ + { + "ename": "TypeError", + "evalue": "() missing 1 required positional argument: 'b'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mdivisible5\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m10\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m: () missing 1 required positional argument: 'b'" + ] + } + ], "source": [ "divisible5(10)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, "metadata": {}, - "outputs": [], + "outputs": [ + { + "ename": "TypeError", + "evalue": "() missing 1 required positional argument: 'b'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mdivisible5\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m8\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m: () missing 1 required positional argument: 'b'" + ] + } + ], "source": [ "divisible5(8)" ] @@ -269,7 +352,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.2" + "version": "3.8.6" } }, "nbformat": 4,