Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
249 changes: 222 additions & 27 deletions your-code/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -29,9 +29,40 @@
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]\n"
]
}
],
"source": [
"#your code here"
"numbers = []\n",
"\n",
"for i in range(1,51):\n",
" numbers.append(i)\n",
"\n",
"print(numbers)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]\n"
]
}
],
"source": [
"numbers = [i for i in range(1,51)]\n",
"print(numbers)"
]
},
{
Expand All @@ -43,11 +74,20 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200]\n"
]
}
],
"source": [
"#your code here"
"numbers2 = [i for i in range(2,201) if i % 2 == 0 ]\n",
"print(numbers2)"
]
},
{
Expand All @@ -59,7 +99,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -77,11 +117,67 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"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": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#your code here"
"new_list = []\n",
"for i in a :\n",
" for k in i:\n",
" new_list.append(k)\n",
"\n",
"flattened_list = [k for i in a for k in i] \n",
"flattened_list "
]
},
{
Expand All @@ -93,11 +189,42 @@
},
{
"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",
"flattened_list2 = [k for i in a for k in i if k > 0.5] \n",
"flattened_list2 "
]
},
{
Expand All @@ -109,7 +236,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -131,11 +258,58 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 15,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"[[0.55867166, 0.06210792, 0.08147297],\n",
" [0.55867166, 0.06210792, 0.08147297],\n",
" [0.55867166, 0.06210792, 0.08147297],\n",
" [0.82579068, 0.91512478, 0.06833034],\n",
" [0.82579068, 0.91512478, 0.06833034],\n",
" [0.82579068, 0.91512478, 0.06833034],\n",
" [0.05440634, 0.65857693, 0.30296619],\n",
" [0.05440634, 0.65857693, 0.30296619],\n",
" [0.05440634, 0.65857693, 0.30296619],\n",
" [0.06769833, 0.96031863, 0.51293743],\n",
" [0.06769833, 0.96031863, 0.51293743],\n",
" [0.06769833, 0.96031863, 0.51293743],\n",
" [0.09143215, 0.71893382, 0.45850679],\n",
" [0.09143215, 0.71893382, 0.45850679],\n",
" [0.09143215, 0.71893382, 0.45850679],\n",
" [0.58256464, 0.59005654, 0.56266457],\n",
" [0.58256464, 0.59005654, 0.56266457],\n",
" [0.58256464, 0.59005654, 0.56266457],\n",
" [0.71600294, 0.87392666, 0.11434044],\n",
" [0.71600294, 0.87392666, 0.11434044],\n",
" [0.71600294, 0.87392666, 0.11434044],\n",
" [0.8694668, 0.65669313, 0.10708681],\n",
" [0.8694668, 0.65669313, 0.10708681],\n",
" [0.8694668, 0.65669313, 0.10708681],\n",
" [0.07529684, 0.46470767, 0.47984544],\n",
" [0.07529684, 0.46470767, 0.47984544],\n",
" [0.07529684, 0.46470767, 0.47984544],\n",
" [0.65368638, 0.14901286, 0.23760688],\n",
" [0.65368638, 0.14901286, 0.23760688],\n",
" [0.65368638, 0.14901286, 0.23760688]]"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#your code here"
"new_list3 = []\n",
"for i in b :\n",
" for k in i:\n",
" for j in k:\n",
" new_list3.append(j)\n",
"\n",
"flattened_list3 = [k for i in b for k in i for j in k] \n",
"flattened_list3 "
]
},
{
Expand All @@ -147,11 +321,37 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 17,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"[[0.55867166, 0.06210792, 0.08147297],\n",
" [0.55867166, 0.06210792, 0.08147297],\n",
" [0.82579068, 0.91512478, 0.06833034],\n",
" [0.05440634, 0.65857693, 0.30296619],\n",
" [0.05440634, 0.65857693, 0.30296619],\n",
" [0.06769833, 0.96031863, 0.51293743],\n",
" [0.09143215, 0.71893382, 0.45850679],\n",
" [0.09143215, 0.71893382, 0.45850679],\n",
" [0.71600294, 0.87392666, 0.11434044],\n",
" [0.8694668, 0.65669313, 0.10708681],\n",
" [0.07529684, 0.46470767, 0.47984544],\n",
" [0.07529684, 0.46470767, 0.47984544],\n",
" [0.07529684, 0.46470767, 0.47984544],\n",
" [0.65368638, 0.14901286, 0.23760688],\n",
" [0.65368638, 0.14901286, 0.23760688]]"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#your code here"
"flattened_list3 = [k for i in b for k in i for j in k if j <= 0.5] \n",
"flattened_list3"
]
},
{
Expand Down Expand Up @@ -191,7 +391,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "base",
"language": "python",
"name": "python3"
},
Expand All @@ -205,12 +405,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
},
"vscode": {
"interpreter": {
"hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
}
"version": "3.13.5"
}
},
"nbformat": 4,
Expand Down