Skip to content
Merged
Show file tree
Hide file tree
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
67 changes: 64 additions & 3 deletions Intermediate.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2300,11 +2300,72 @@
},
"outputs": [],
"source": [
"# Initialising a tuple with values\n",
"\n",
"# Initialising a tuple with values\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7e873494-6a43-4402-beee-5bc2d507f33a",
"metadata": {
"remove_code": "non-comments",
"slideshow": {
"slide_type": ""
}
},
"outputs": [],
"source": [
"# Initialising a tuple with one value\n"
]
},
{
"cell_type": "markdown",
"id": "812d5a14",
"metadata": {
"editable": false,
"slideshow": {
"slide_type": "fragment"
},
"tags": []
},
"source": [
"<b>Tuple Unpacking</b>"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "22e2a236-df2d-4130-9810-5bfd4f0ccb49",
"metadata": {
"editable": true,
"remove_code": "non-comments",
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"source": [
"# The most basic example of tuple unpacking\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d2638ed7-4344-4297-b31b-bcdd649889c7",
"metadata": {
"editable": true,
"remove_code": "non-comments",
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"source": [
"# You can use tuple unpacking when a function returns multiple values, or a tuple!\n"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -2346,7 +2407,7 @@
},
{
"cell_type": "markdown",
"id": "812d5a14",
"id": "9380a5f8",
"metadata": {
"slideshow": {
"slide_type": "fragment"
Expand Down
90 changes: 87 additions & 3 deletions Intermediate_full.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2244,13 +2244,97 @@
"source": [
"# Initialising a tuple with values\n",
"my_tuple = (1,2,3)\n",
"print(my_tuple)\n",
"\n",
"print(my_tuple)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7e873494-6a43-4402-beee-5bc2d507f33a",
"metadata": {
"remove_code": "non-comments",
"slideshow": {
"slide_type": ""
}
},
"outputs": [],
"source": [
"# Initialising a tuple with one value\n",
"my_tuple = (1,)\n",
"print(my_tuple)"
]
},
{
"cell_type": "markdown",
"id": "812d5a14",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "fragment"
},
"tags": []
},
"source": [
"<b>Tuple Unpacking</b>"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "22e2a236-df2d-4130-9810-5bfd4f0ccb49",
"metadata": {
"editable": true,
"remove_code": "non-comments",
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"source": [
"# The most basic example of tuple unpacking\n",
"a, b = 1, 2\n",
"print(a)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d2638ed7-4344-4297-b31b-bcdd649889c7",
"metadata": {
"editable": true,
"remove_code": "non-comments",
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"source": [
"# You can use tuple unpacking when a function returns multiple values, or a tuple!\n",
"def get_full_name():\n",
" return \"First\", \"Last\"\n",
"\n",
"first, last = get_full_name()\n",
"print(first, last)"
]
},
{
"cell_type": "markdown",
"id": "4ef4d631-b632-4712-a659-ed59f03c676b",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "notes"
},
"tags": []
},
"source": [
"<ins>Speaker Notes:</ins>\n",
"\n",
"We can omit the brackets here (for the first example)."
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -2296,7 +2380,7 @@
},
{
"cell_type": "markdown",
"id": "812d5a14",
"id": "9380a5f8",
"metadata": {
"slideshow": {
"slide_type": "fragment"
Expand Down
Loading