Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
PythonTutorial
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
SWW
Tutorials
PythonTutorial
Commits
7cb62627
Commit
7cb62627
authored
Nov 19, 2019
by
christian.foerster
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor changes
parent
73d053b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
32 deletions
+31
-32
Python Tutorial - Basics.ipynb
Python Tutorial - Basics.ipynb
+31
-32
No files found.
Python Tutorial - Basics.ipynb
View file @
7cb62627
...
@@ -440,7 +440,7 @@
...
@@ -440,7 +440,7 @@
"cell_type": "markdown",
"cell_type": "markdown",
"metadata": {},
"metadata": {},
"source": [
"source": [
"### Tup
el
"
"### Tup
le
"
]
]
},
},
{
{
...
@@ -945,36 +945,19 @@
...
@@ -945,36 +945,19 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# you can even pass functions as function arguments\n",
"def add_ten(func,a,b):\n",
" '''\n",
" my function\n",
" '''\n",
" return func(a,b)+10\n",
"\n",
"print(add_ten(sum_2,0,1))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"sys.getrecursionlimit()\n",
"#sys.setrecursionlimit()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1.54 ms ± 69.5 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)\n",
"1.02 ms ± 23.7 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)\n",
"842 µs ± 22 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)\n"
]
}
],
"source": [
"source": [
"# recursion works like this (std limit 3000)\n",
"# recursion works like this (std limit 3000)\n",
"def factorial_slow(n):\n",
"def factorial_slow(n):\n",
...
@@ -982,7 +965,7 @@
...
@@ -982,7 +965,7 @@
" if n==1:\n",
" if n==1:\n",
" return n\n",
" return n\n",
" else:\n",
" else:\n",
" return n*factorial(n-1)\n",
" return n*factorial
_slow
(n-1)\n",
"\n",
"\n",
"# lets compare the execution time of recursion to a while loop\n",
"# lets compare the execution time of recursion to a while loop\n",
"def factorial_fast(m):\n",
"def factorial_fast(m):\n",
...
@@ -1013,6 +996,22 @@
...
@@ -1013,6 +996,22 @@
"# for is faster than while\n"
"# for is faster than while\n"
]
]
},
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# you can even pass functions as function arguments\n",
"def add_ten(func,a,b):\n",
" '''\n",
" my function\n",
" '''\n",
" return func(a,b)+10\n",
"\n",
"print(add_ten(sum_2,0,1))"
]
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": null,
"execution_count": null,
...
@@ -1800,7 +1799,7 @@
...
@@ -1800,7 +1799,7 @@
"name": "python",
"name": "python",
"nbconvert_exporter": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"pygments_lexer": "ipython3",
"version": "3.
6.8
"
"version": "3.
7.4
"
}
}
},
},
"nbformat": 4,
"nbformat": 4,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment