Skip to content

Commit e3a44ad

Browse files
committed
Added jupyter notebook
1 parent 553b10d commit e3a44ad

1 file changed

Lines changed: 79 additions & 0 deletions

File tree

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"source": [
6+
"## Functions as Arguments"
7+
],
8+
"metadata": {}
9+
},
10+
{
11+
"cell_type": "code",
12+
"execution_count": 2,
13+
"source": [
14+
"def say_hello():\r\n",
15+
" print(\"Hello\")\r\n",
16+
"\r\n",
17+
"print(type(say_hello))\r\n",
18+
"sh = say_hello\r\n",
19+
"sh()"
20+
],
21+
"outputs": [
22+
{
23+
"output_type": "stream",
24+
"name": "stdout",
25+
"text": [
26+
"<class 'function'>\n",
27+
"Hello\n"
28+
]
29+
}
30+
],
31+
"metadata": {}
32+
},
33+
{
34+
"cell_type": "code",
35+
"execution_count": null,
36+
"source": [
37+
"def say_hello():\r\n",
38+
" return \"Hello\"\r\n",
39+
"\r\n",
40+
"def say_gracias():\r\n",
41+
" return \"Gracias\"\r\n",
42+
"\r\n",
43+
"def greet(func, name):\r\n",
44+
" message = f\"{func()} {name}\"\r\n",
45+
" print(message)\r\n",
46+
"\r\n",
47+
"greet(say_hello, \"QT\")\r\n",
48+
"greet(say_gracias, \"IHub\")\r\n",
49+
"\r\n"
50+
],
51+
"outputs": [],
52+
"metadata": {}
53+
}
54+
],
55+
"metadata": {
56+
"orig_nbformat": 4,
57+
"language_info": {
58+
"name": "python",
59+
"version": "3.9.4",
60+
"mimetype": "text/x-python",
61+
"codemirror_mode": {
62+
"name": "ipython",
63+
"version": 3
64+
},
65+
"pygments_lexer": "ipython3",
66+
"nbconvert_exporter": "python",
67+
"file_extension": ".py"
68+
},
69+
"kernelspec": {
70+
"name": "python3",
71+
"display_name": "Python 3.9.4 64-bit"
72+
},
73+
"interpreter": {
74+
"hash": "63fd5069d213b44bf678585dea6b12cceca9941eaf7f819626cde1f2670de90d"
75+
}
76+
},
77+
"nbformat": 4,
78+
"nbformat_minor": 2
79+
}

0 commit comments

Comments
 (0)