From d20720e2818bc02e1b116d15b6d7f788edaa8254 Mon Sep 17 00:00:00 2001 From: rah0703 Date: Tue, 10 Dec 2024 16:23:14 -0400 Subject: [PATCH] Update Main --- your-code/main.ipynb | 399 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 378 insertions(+), 21 deletions(-) diff --git a/your-code/main.ipynb b/your-code/main.ipynb index d584552..3fb47a4 100644 --- a/your-code/main.ipynb +++ b/your-code/main.ipynb @@ -11,7 +11,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -27,11 +27,74 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "[1,\n", + " 2,\n", + " 3,\n", + " 4,\n", + " 5,\n", + " 6,\n", + " 7,\n", + " 8,\n", + " 9,\n", + " 10,\n", + " 11,\n", + " 12,\n", + " 13,\n", + " 14,\n", + " 15,\n", + " 16,\n", + " 17,\n", + " 18,\n", + " 19,\n", + " 20,\n", + " 21,\n", + " 22,\n", + " 23,\n", + " 24,\n", + " 25,\n", + " 26,\n", + " 27,\n", + " 28,\n", + " 29,\n", + " 30,\n", + " 31,\n", + " 32,\n", + " 33,\n", + " 34,\n", + " 35,\n", + " 36,\n", + " 37,\n", + " 38,\n", + " 39,\n", + " 40,\n", + " 41,\n", + " 42,\n", + " 43,\n", + " 44,\n", + " 45,\n", + " 46,\n", + " 47,\n", + " 48,\n", + " 49,\n", + " 50]" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "#your code here" + "#your code here\n", + "consecutive_int = [i for i in range(1, 51)]\n", + "\n", + "consecutive_int" ] }, { @@ -43,11 +106,124 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "[2,\n", + " 4,\n", + " 6,\n", + " 8,\n", + " 10,\n", + " 12,\n", + " 14,\n", + " 16,\n", + " 18,\n", + " 20,\n", + " 22,\n", + " 24,\n", + " 26,\n", + " 28,\n", + " 30,\n", + " 32,\n", + " 34,\n", + " 36,\n", + " 38,\n", + " 40,\n", + " 42,\n", + " 44,\n", + " 46,\n", + " 48,\n", + " 50,\n", + " 52,\n", + " 54,\n", + " 56,\n", + " 58,\n", + " 60,\n", + " 62,\n", + " 64,\n", + " 66,\n", + " 68,\n", + " 70,\n", + " 72,\n", + " 74,\n", + " 76,\n", + " 78,\n", + " 80,\n", + " 82,\n", + " 84,\n", + " 86,\n", + " 88,\n", + " 90,\n", + " 92,\n", + " 94,\n", + " 96,\n", + " 98,\n", + " 100,\n", + " 102,\n", + " 104,\n", + " 106,\n", + " 108,\n", + " 110,\n", + " 112,\n", + " 114,\n", + " 116,\n", + " 118,\n", + " 120,\n", + " 122,\n", + " 124,\n", + " 126,\n", + " 128,\n", + " 130,\n", + " 132,\n", + " 134,\n", + " 136,\n", + " 138,\n", + " 140,\n", + " 142,\n", + " 144,\n", + " 146,\n", + " 148,\n", + " 150,\n", + " 152,\n", + " 154,\n", + " 156,\n", + " 158,\n", + " 160,\n", + " 162,\n", + " 164,\n", + " 166,\n", + " 168,\n", + " 170,\n", + " 172,\n", + " 174,\n", + " 176,\n", + " 178,\n", + " 180,\n", + " 182,\n", + " 184,\n", + " 186,\n", + " 188,\n", + " 190,\n", + " 192,\n", + " 194,\n", + " 196,\n", + " 198,\n", + " 200]" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "#your code here" + "#your code here\n", + "even_num = [i for i in range(2,201, 2)]\n", + "\n", + "even_num" ] }, { @@ -77,11 +253,75 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "[0.84062117,\n", + " 0.48006452,\n", + " 0.7876326,\n", + " 0.77109654,\n", + " 0.44409793,\n", + " 0.09014516,\n", + " 0.81835917,\n", + " 0.87645456,\n", + " 0.7066597,\n", + " 0.09610873,\n", + " 0.41247947,\n", + " 0.57433389,\n", + " 0.29960807,\n", + " 0.42315023,\n", + " 0.34452557,\n", + " 0.4751035,\n", + " 0.17003563,\n", + " 0.46843998,\n", + " 0.92796258,\n", + " 0.69814654,\n", + " 0.41290051,\n", + " 0.19561071,\n", + " 0.16284783,\n", + " 0.97016248,\n", + " 0.71725408,\n", + " 0.87702738,\n", + " 0.31244595,\n", + " 0.76615487,\n", + " 0.20754036,\n", + " 0.57871812,\n", + " 0.07214068,\n", + " 0.40356048,\n", + " 0.12149553,\n", + " 0.53222417,\n", + " 0.9976855,\n", + " 0.12536346,\n", + " 0.80930099,\n", + " 0.50962849,\n", + " 0.94555126,\n", + " 0.33364763]" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "#your code here" + "#your code here\n", + "a = [[0.84062117, 0.48006452, 0.7876326 , 0.77109654],\n", + " [0.44409793, 0.09014516, 0.81835917, 0.87645456],\n", + " [0.7066597 , 0.09610873, 0.41247947, 0.57433389],\n", + " [0.29960807, 0.42315023, 0.34452557, 0.4751035 ],\n", + " [0.17003563, 0.46843998, 0.92796258, 0.69814654],\n", + " [0.41290051, 0.19561071, 0.16284783, 0.97016248],\n", + " [0.71725408, 0.87702738, 0.31244595, 0.76615487],\n", + " [0.20754036, 0.57871812, 0.07214068, 0.40356048],\n", + " [0.12149553, 0.53222417, 0.9976855 , 0.12536346],\n", + " [0.80930099, 0.50962849, 0.94555126, 0.33364763]];\n", + "\n", + "flattened_list = [element for row in a for element in row]\n", + "\n", + "flattened_list\n" ] }, { @@ -93,11 +333,44 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "[0.84062117,\n", + " 0.7876326,\n", + " 0.77109654,\n", + " 0.81835917,\n", + " 0.87645456,\n", + " 0.7066597,\n", + " 0.57433389,\n", + " 0.92796258,\n", + " 0.69814654,\n", + " 0.97016248,\n", + " 0.71725408,\n", + " 0.87702738,\n", + " 0.76615487,\n", + " 0.57871812,\n", + " 0.53222417,\n", + " 0.9976855,\n", + " 0.80930099,\n", + " 0.50962849,\n", + " 0.94555126]" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "#your code here" + "#your code here\n", + "\n", + "flattened_condition_list = [element for row in a for element in row if element >= 0.5]\n", + "\n", + "flattened_condition_list" ] }, { @@ -131,11 +404,69 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "[0.55867166,\n", + " 0.06210792,\n", + " 0.08147297,\n", + " 0.82579068,\n", + " 0.91512478,\n", + " 0.06833034,\n", + " 0.05440634,\n", + " 0.65857693,\n", + " 0.30296619,\n", + " 0.06769833,\n", + " 0.96031863,\n", + " 0.51293743,\n", + " 0.09143215,\n", + " 0.71893382,\n", + " 0.45850679,\n", + " 0.58256464,\n", + " 0.59005654,\n", + " 0.56266457,\n", + " 0.71600294,\n", + " 0.87392666,\n", + " 0.11434044,\n", + " 0.8694668,\n", + " 0.65669313,\n", + " 0.10708681,\n", + " 0.07529684,\n", + " 0.46470767,\n", + " 0.47984544,\n", + " 0.65368638,\n", + " 0.14901286,\n", + " 0.23760688]" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "#your code here" + "#your code here\n", + "b = [[[0.55867166, 0.06210792, 0.08147297],\n", + " [0.82579068, 0.91512478, 0.06833034]],\n", + "\n", + " [[0.05440634, 0.65857693, 0.30296619],\n", + " [0.06769833, 0.96031863, 0.51293743]],\n", + "\n", + " [[0.09143215, 0.71893382, 0.45850679],\n", + " [0.58256464, 0.59005654, 0.56266457]],\n", + "\n", + " [[0.71600294, 0.87392666, 0.11434044],\n", + " [0.8694668 , 0.65669313, 0.10708681]],\n", + "\n", + " [[0.07529684, 0.46470767, 0.47984544],\n", + " [0.65368638, 0.14901286, 0.23760688]]];\n", + "\n", + "flattened_list = [element for sublist1 in b for sublist2 in sublist1 for element in sublist2]\n", + "\n", + "flattened_list" ] }, { @@ -147,11 +478,37 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "[0.08147297,\n", + " 0.06833034,\n", + " 0.30296619,\n", + " 0.45850679,\n", + " 0.11434044,\n", + " 0.10708681,\n", + " 0.47984544,\n", + " 0.23760688]" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "#your code here" + "#your code here\n", + "condition_list = [\n", + " sublist2[-1]\n", + " for sublist1 in b \n", + " for sublist2 in sublist1\n", + " if sublist2[-1] <= 0.5\n", + "]\n", + "\n", + "condition_list" ] }, { @@ -205,7 +562,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.12.7" }, "vscode": { "interpreter": { @@ -214,5 +571,5 @@ } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 }