Skip to content

Commit 92350f6

Browse files
committed
Update execution count and remove unnecessary code in Python_Class.ipynb
1 parent 19d81d3 commit 92350f6

File tree

2 files changed

+62
-7
lines changed

2 files changed

+62
-7
lines changed

Python_Class.ipynb

Lines changed: 61 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,7 +1461,7 @@
14611461
},
14621462
{
14631463
"cell_type": "code",
1464-
"execution_count": 9,
1464+
"execution_count": 4,
14651465
"metadata": {},
14661466
"outputs": [
14671467
{
@@ -1474,13 +1474,12 @@
14741474
],
14751475
"source": [
14761476
"lst = [\"Anurag\", \"Manav\", \"Farhan\", \"Manav\", \"Ayushi\", \"Shoeb\"]\n",
1477-
"new_lst = []\n",
14781477
"\n",
1479-
"for i in lst:\n",
1480-
" if i != \"Manav\":\n",
1481-
" new_lst.append(i)\n",
14821478
"\n",
1483-
"print(new_lst)"
1479+
"while \"Manav\" in lst:\n",
1480+
" lst.remove(\"Manav\")\n",
1481+
"\n",
1482+
"print(lst)"
14841483
]
14851484
},
14861485
{
@@ -1506,6 +1505,62 @@
15061505
" \n",
15071506
"print(lst)"
15081507
]
1508+
},
1509+
{
1510+
"cell_type": "code",
1511+
"execution_count": 2,
1512+
"metadata": {},
1513+
"outputs": [
1514+
{
1515+
"data": {
1516+
"text/plain": [
1517+
"[[93, 24, 99, 2, 6],\n",
1518+
" [95, 98, 34, 43, 86],\n",
1519+
" [45, 10, 8, 21, 62],\n",
1520+
" [8, 11, 3, 3, 26],\n",
1521+
" [37, 47, 66, 30, 10]]"
1522+
]
1523+
},
1524+
"execution_count": 2,
1525+
"metadata": {},
1526+
"output_type": "execute_result"
1527+
}
1528+
],
1529+
"source": [
1530+
"import random\n",
1531+
"\n",
1532+
"def get_2d_list():\n",
1533+
" lst = [[random.randint(1, 100) for x in range(5)] for x in range(5)]\n",
1534+
" return lst\n",
1535+
"\n",
1536+
"lst = get_2d_list()\n",
1537+
"lst"
1538+
]
1539+
},
1540+
{
1541+
"cell_type": "code",
1542+
"execution_count": 3,
1543+
"metadata": {},
1544+
"outputs": [
1545+
{
1546+
"data": {
1547+
"text/plain": [
1548+
"[[93, 24, 99, 2, 6],\n",
1549+
" [95, 98, 56, 43, 86],\n",
1550+
" [45, 10, 8, 21, 62],\n",
1551+
" [8, 11, 3, 3, 26],\n",
1552+
" [37, 47, 66, 30, 10]]"
1553+
]
1554+
},
1555+
"execution_count": 3,
1556+
"metadata": {},
1557+
"output_type": "execute_result"
1558+
}
1559+
],
1560+
"source": [
1561+
"lst[1][2] = random.randint(1, 100)\n",
1562+
"lst"
1563+
]
15091564
}
15101565
],
15111566
"metadata": {

assignment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@ def print_students(students):
6161
elif option == 6:
6262
break
6363
else:
64-
print("Invalid option!")
64+
print("Invalid option!")

0 commit comments

Comments
 (0)