Skip to content
Open

W1D1 #133

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
130 changes: 101 additions & 29 deletions your-code/challenges.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,29 @@
"**In the cell below, define a variable `tup` with a single element `\"I\"`.**\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 15,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"I\n"
]
}
],
"source": [
"# Your code here"
"# Your code here \n",
"tup = (\"I\")\n",
"print (tup)\n",
"\n"
]
},
{
Expand All @@ -31,11 +47,22 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'str'>\n"
]
}
],
"source": [
"# Your code here"
"# Your code here\n",
"print (type (tup ))\n",
"\n",
"\n"
]
},
{
Expand All @@ -53,13 +80,27 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 36,
"metadata": {
"scrolled": true
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['I', ['r', 'o', 'n', 'h', ' a', 'c', 'k']]\n"
]
}
],
"source": [
"# Your code here\n",
"tup = [\"I\"]\n",
"tap = ['r', 'o', 'n', 'h',' a', 'c', 'k' ]\n",
"tup.append(tap)\n",
"print (tup)\n",
"\n",
"\n",
"\n",
"# Your explanation here\n",
"# You can :) "
Expand All @@ -80,11 +121,22 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 38,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['I', 'r', 'o', 'n', 'h', ' a', 'c', 'k']\n"
]
}
],
"source": [
"# Your code here"
"# Your code here\n",
"lista = ['I', ['r', 'o', 'n', 'h', ' a', 'c', 'k']]\n",
"tup = [lista[0]] + lista[1]\n",
"print (tup)"
]
},
{
Expand All @@ -102,11 +154,26 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 45,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['I', 'r', 'o', 'n']\n",
"['h', ' a', 'c', 'k']\n"
]
}
],
"source": [
"# Your code here"
"# Your code here\n",
"tup1 = tup[:4]\n",
"print(tup1)\n",
"\n",
"tup2 = tup[-4:]\n",
"print(tup2)\n",
"\n"
]
},
{
Expand All @@ -120,11 +187,21 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 46,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['I', 'r', 'o', 'n', 'h', ' a', 'c', 'k']\n"
]
}
],
"source": [
"# Your code here"
"# Your code here\n",
"tup3 = tup1 + tup2\n",
"print(tup3)\n"
]
},
{
Expand All @@ -140,7 +217,7 @@
"metadata": {},
"outputs": [],
"source": [
"# Your code here"
"# Your code here\n"
]
},
{
Expand Down Expand Up @@ -602,7 +679,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "base",
"language": "python",
"name": "python3"
},
Expand All @@ -616,12 +693,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