diff --git a/your-code/main.ipynb b/your-code/main.ipynb index 01257d4..dc0f76b 100755 --- a/your-code/main.ipynb +++ b/your-code/main.ipynb @@ -21,7 +21,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 12, "metadata": {}, "outputs": [], "source": [ @@ -32,7 +32,7 @@ " \"\"\"\n", " \n", " # your code here\n", - " " + " return [lmbda(x) for x in lst]\n" ] }, { @@ -46,11 +46,12 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ - "# your code here" + "# your code here\n", + "celsius_conv = lambda c: c + 273.15" ] }, { @@ -62,13 +63,25 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 14, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "[285.15, 296.15, 311.15, 218.14999999999998, 297.15]" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "temps = [12, 23, 38, -55, 24]\n", "\n", - "# your code here" + "# your code here\n", + "modify_list(temps, celsius_conv)" ] }, { @@ -86,7 +99,8 @@ "metadata": {}, "outputs": [], "source": [ - "# your code here" + "# your code here\n", + "mod=lambda x,y: 1 if x % y == 0 else 0" ] }, { @@ -100,7 +114,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 18, "metadata": {}, "outputs": [], "source": [ @@ -111,7 +125,8 @@ " divisible by another number (to be passed later) and zero otherwise.\n", " \"\"\"\n", " \n", - " # your code here" + " # your code here\n", + " return lambda x: 1 if x % b == 0 else 0" ] }, { @@ -123,11 +138,12 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 19, "metadata": {}, "outputs": [], "source": [ - "# your code here" + "# your code here\n", + "divisible5 = divisor(5)" ] }, { @@ -139,18 +155,41 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "1" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ + "divisible5 = divisor(5)\n", "divisible5(10)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "0" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "divisible5(8)" ] @@ -199,14 +238,27 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 23, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "['Green eggs', 'cheese', 'English cucumber', 'tomato']" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "list1 = ['Green', 'cheese', 'English', 'tomato']\n", "list2 = ['eggs', 'cheese', 'cucumber', 'tomato']\n", "\n", - "# your code here" + "# your code here\n", + "comb_strings_spaces = lambda a, b: a + ' ' + b if a != b else a\n", + "[comb_strings_spaces(a, b) for (a, b) in zip(list1, list2)]" ] }, { @@ -269,7 +321,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.2" + "version": "3.8.3" } }, "nbformat": 4,