Skip to content

Commit 59be313

Browse files
committed
Added ToCs in Functions.ipynb
1 parent 62e6d30 commit 59be313

File tree

1 file changed

+48
-16
lines changed

1 file changed

+48
-16
lines changed

basic/Functions.ipynb

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,49 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"# Function\n",
7+
"**Table of contents**<a id='toc0_'></a> \n",
8+
"- [Function](#toc1_) \n",
9+
"- [Python Function Types](#toc2_) \n",
10+
" - [Built-in functions](#toc2_1_) \n",
11+
"- [User-defined Functions](#toc3_) \n",
12+
"- [Python Function Arguments](#toc4_) \n",
13+
" - [Function Argument with Default Values](#toc4_1_) \n",
14+
" - [Keyword Argument](#toc4_2_) \n",
15+
"- [Function With Arbitrary Arguments](#toc5_) \n",
16+
"- [Python Recursive Function](#toc6_) \n",
17+
"- [Python Lambda/Anonymous Function](#toc7_) \n",
18+
"- [Python Modules](#toc8_) \n",
19+
" - [Python Standard Library Modules](#toc8_1_) \n",
20+
"- [The dir() built-in function](#toc9_) \n",
21+
"- [Python Package](#toc10_) \n",
22+
" - [Package Model Structure in Python Programming](#toc10_1_) \n",
23+
" - [Importing module from a package](#toc10_1_1_) \n",
24+
"\n",
25+
"<!-- vscode-jupyter-toc-config\n",
26+
"\tnumbering=false\n",
27+
"\tanchor=true\n",
28+
"\tflat=false\n",
29+
"\tminLevel=1\n",
30+
"\tmaxLevel=6\n",
31+
"\t/vscode-jupyter-toc-config -->\n",
32+
"<!-- THIS CELL WILL BE REPLACED ON TOC UPDATE. DO NOT WRITE YOUR TEXT IN THIS CELL -->"
33+
]
34+
},
35+
{
36+
"cell_type": "markdown",
37+
"metadata": {},
38+
"source": [
39+
"# <a id='toc1_'></a>[Function](#toc0_)\n",
840
"\n",
941
"- Function is a code block that is used to perform a specific task.\n",
1042
"- Dividing a complex problem into smaller chunks makes our program easy to understand and reuse.\n",
1143
"\n",
12-
"# Python Function Types\n",
44+
"# <a id='toc2_'></a>[Python Function Types](#toc0_)\n",
1345
"\n",
1446
"- Built-in functions (aka Standard library functions)\n",
1547
"- User-defined functions\n",
1648
"\n",
17-
"## Built-in functions\n",
49+
"## <a id='toc2_1_'></a>[Built-in functions](#toc0_)\n",
1850
"\n",
1951
"- Function that already exist in programming language to peform specific task in optimized way. \n",
2052
"- Exp: `print()`, `type()`, `id()`, `pow(2,3)`\n",
@@ -210,14 +242,14 @@
210242
"cell_type": "markdown",
211243
"metadata": {},
212244
"source": [
213-
"# User-defined Functions\n",
245+
"# <a id='toc3_'></a>[User-defined Functions](#toc0_)\n",
214246
"\n",
215247
"- These functions are custom functions that are defined to perform a specific task repeatedly. \n",
216248
"\n",
217-
"# Python Function Arguments\n",
249+
"# <a id='toc4_'></a>[Python Function Arguments](#toc0_)\n",
218250
"- In computer programming, an argument is a value that is accepted by a function.\n",
219251
"\n",
220-
"## Function Argument with Default Values\n",
252+
"## <a id='toc4_1_'></a>[Function Argument with Default Values](#toc0_)\n",
221253
"- provide default values to function arguments\n",
222254
"\n",
223255
"\n",
@@ -227,7 +259,7 @@
227259
" print('Sum:', sum)\n",
228260
"```\n",
229261
"\n",
230-
"## Keyword Argument\n",
262+
"## <a id='toc4_2_'></a>[Keyword Argument](#toc0_)\n",
231263
"- In keyword arguments, arguments are assigned based on the name of arguments.\n",
232264
"\n",
233265
"```\n",
@@ -239,7 +271,7 @@
239271
"```\n",
240272
"\n",
241273
"\n",
242-
"# Function With Arbitrary Arguments\n",
274+
"# <a id='toc5_'></a>[Function With Arbitrary Arguments](#toc0_)\n",
243275
"- When we do not know in advance the number of arguments that will be passed into a function. To handle this kind of situation, we can use arbitrary arguments in Python.\n",
244276
"- We use an asterisk (*) before the parameter name to denote this kind of argument\n",
245277
"\n",
@@ -434,7 +466,7 @@
434466
"cell_type": "markdown",
435467
"metadata": {},
436468
"source": [
437-
"# Python Recursive Function\n",
469+
"# <a id='toc6_'></a>[Python Recursive Function](#toc0_)\n",
438470
"- In Python, we know that a function can call other functions. It is even possible for the function to call itself. These types of construct are termed as `recursive functions`.\n",
439471
"\n",
440472
"**Base condition (Terminating conditon)**\n",
@@ -478,7 +510,7 @@
478510
"cell_type": "markdown",
479511
"metadata": {},
480512
"source": [
481-
"# Python Lambda/Anonymous Function\n",
513+
"# <a id='toc7_'></a>[Python Lambda/Anonymous Function](#toc0_)\n",
482514
"\n",
483515
"- In Python, a lambda function is a special type of function without the function name. \n",
484516
"\n",
@@ -615,7 +647,7 @@
615647
"cell_type": "markdown",
616648
"metadata": {},
617649
"source": [
618-
"# Python Modules\n",
650+
"# <a id='toc8_'></a>[Python Modules](#toc0_)\n",
619651
"\n",
620652
"Module is a file that contains code to perform a specific task. A module may contain variables, functions, classes etc.\n",
621653
"\n",
@@ -625,7 +657,7 @@
625657
"- `Access Function defined in Module` >> `arithmetic.add()`\n",
626658
"\n",
627659
"\n",
628-
"## Python Standard Library Modules\n",
660+
"## <a id='toc8_1_'></a>[Python Standard Library Modules](#toc0_)\n",
629661
"\n",
630662
"- The Python standard library contains well over 200 modules.\n",
631663
"\n",
@@ -637,7 +669,7 @@
637669
"print(\"The value of pi is\", math.pi)\n",
638670
"```\n",
639671
"\n",
640-
"# The dir() built-in function\n",
672+
"# <a id='toc9_'></a>[The dir() built-in function](#toc0_)\n",
641673
"\n",
642674
"In Python, we can use the dir() function to list all the function names in a module.\n",
643675
"\n",
@@ -690,7 +722,7 @@
690722
"cell_type": "markdown",
691723
"metadata": {},
692724
"source": [
693-
"# Python Package\n",
725+
"# <a id='toc10_'></a>[Python Package](#toc0_)\n",
694726
"\n",
695727
"\n",
696728
"- A package is `a container` that contains various functions to perform specific tasks. For example, the `math` package includes the `sqrt()` function to perform the square root of a number.\n",
@@ -703,7 +735,7 @@
703735
"- A directory must contain a file named __init__.py in order for Python to consider it as a package. \n",
704736
" - This file can be left empty but we generally place the initialization code for that package in this file.\n",
705737
"\n",
706-
"## Package Model Structure in Python Programming\n",
738+
"## <a id='toc10_1_'></a>[Package Model Structure in Python Programming](#toc0_)\n",
707739
"\n",
708740
"Suppose we are developing a game. One possible organization of packages and modules could be as shown in the figure below.\n",
709741
"\n",
@@ -717,7 +749,7 @@
717749
"\n",
718750
"\n",
719751
"\n",
720-
"### Importing module from a package\n",
752+
"### <a id='toc10_1_1_'></a>[Importing module from a package](#toc0_)\n",
721753
"```\n",
722754
"import Game.Level.start\n",
723755
"Game.Level.start.select_difficulty(2)\n",

0 commit comments

Comments
 (0)