Skip to content

Commit 19d81d3

Browse files
committed
Add code for removing 'Manav' from the list
1 parent e17e99a commit 19d81d3

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

Python_Class.ipynb

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,6 +1458,54 @@
14581458
"print(odds)\n",
14591459
"print(final_list)\n"
14601460
]
1461+
},
1462+
{
1463+
"cell_type": "code",
1464+
"execution_count": 9,
1465+
"metadata": {},
1466+
"outputs": [
1467+
{
1468+
"name": "stdout",
1469+
"output_type": "stream",
1470+
"text": [
1471+
"['Anurag', 'Farhan', 'Ayushi', 'Shoeb']\n"
1472+
]
1473+
}
1474+
],
1475+
"source": [
1476+
"lst = [\"Anurag\", \"Manav\", \"Farhan\", \"Manav\", \"Ayushi\", \"Shoeb\"]\n",
1477+
"new_lst = []\n",
1478+
"\n",
1479+
"for i in lst:\n",
1480+
" if i != \"Manav\":\n",
1481+
" new_lst.append(i)\n",
1482+
"\n",
1483+
"print(new_lst)"
1484+
]
1485+
},
1486+
{
1487+
"cell_type": "code",
1488+
"execution_count": 13,
1489+
"metadata": {},
1490+
"outputs": [
1491+
{
1492+
"name": "stdout",
1493+
"output_type": "stream",
1494+
"text": [
1495+
"[]\n"
1496+
]
1497+
}
1498+
],
1499+
"source": [
1500+
"lst = [\"Anurag\", \"Manav\", \"Farhan\", \"Ayushi\", \"Shoeb\"]\n",
1501+
"\n",
1502+
"while True:\n",
1503+
" lst.pop()\n",
1504+
" if len(lst) == 0:\n",
1505+
" break\n",
1506+
" \n",
1507+
"print(lst)"
1508+
]
14611509
}
14621510
],
14631511
"metadata": {

0 commit comments

Comments
 (0)