Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Multiple assignment
  • Loading branch information
Aniruddh-0701 committed Oct 16, 2020
commit fbd13936da1807d4584bc7e9440cee4c51aeec1f
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@
"|$-$ |Subtraction|2 $-$ 3 = -1|\n",
"|$*$ |Multiplication|2 $*$ 3 = 6|\n",
"|$/$ |Division|2 $/$ 3 = 0.66667|\n",
"|$//$\t|Floor Division|2 $//$ 3 = 0|\n",
"|$//$\t|Floor Division (quotient)|2 $//$ 3 = 0|\n",
"|%\t|Modulo (returns remainder)|2 % 3 = 2|\n",
"|$**$\t|Exponentiation|2 $**$ 3 = 8|\n",
"|$+$\t|Unary Plus|$+$ 2|\n",
Expand Down Expand Up @@ -759,6 +759,40 @@
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Muliple Assignment in one line:\n",
"Python allows assignment of different variables in one line.\n",
"\n",
"Syntax: `var1, var2, var3, ... = val1, val2, val3, ...`"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"10\n",
"20\n",
"40\n",
"30\n"
]
}
],
"source": [
"a, b, c, d = 10, 20, 30, 40\n",
"print(a)\n",
"print(b)\n",
"print(d)\n",
"print(c)"
]
}
],
"metadata": {
Expand Down
34 changes: 34 additions & 0 deletions Introduction_to_Python_Programming.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,40 @@
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Muliple Assignment in one line:\n",
"Python allows assignment of different variables in one line.\n",
"\n",
"Syntax: `var1, var2, var3, ... = val1, val2, val3, ...`"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"10\n",
"20\n",
"40\n",
"30\n"
]
}
],
"source": [
"a, b, c, d = 10, 20, 30, 40\n",
"print(a)\n",
"print(b)\n",
"print(d)\n",
"print(c)"
]
}
],
"metadata": {
Expand Down