|
@@ -333,7 +333,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": null,
|
|
|
+ "execution_count": 12,
|
|
|
"metadata": {},
|
|
|
"outputs": [],
|
|
|
"source": [
|
|
@@ -342,9 +342,20 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": null,
|
|
|
+ "execution_count": 13,
|
|
|
"metadata": {},
|
|
|
- "outputs": [],
|
|
|
+ "outputs": [
|
|
|
+ {
|
|
|
+ "data": {
|
|
|
+ "text/plain": [
|
|
|
+ "\"\\nNote: To reproduce exactly the output in this notebook\\nas whole:\\n\\n1. Run all the cells above.\\n2. Restart the program's state but keep the output\\n(click Restart Kernel).\\n3. Then, run only the cells below.\\n\\n\\n(You were not asked in this exercise to write a note like this.\\nThe note above was written to give more details on how to reproduce\\nthe behavior seen in this notebook.)\\n\""
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ "execution_count": 13,
|
|
|
+ "metadata": {},
|
|
|
+ "output_type": "execute_result"
|
|
|
+ }
|
|
|
+ ],
|
|
|
"source": [
|
|
|
"'''\n",
|
|
|
"Note: To reproduce exactly the output in this notebook\n",
|
|
@@ -364,13 +375,94 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 1,
|
|
|
+ "execution_count": 14,
|
|
|
"metadata": {},
|
|
|
"outputs": [
|
|
|
{
|
|
|
"name": "stdout",
|
|
|
"output_type": "stream",
|
|
|
"text": [
|
|
|
+ ">>> welcome_message = 'Hello, Jupyter!'\n",
|
|
|
+ "... first_cell = True\n",
|
|
|
+ "... \n",
|
|
|
+ "... if first_cell:\n",
|
|
|
+ "... print(welcome_message)\n",
|
|
|
+ "...\n",
|
|
|
+ ">>> result = 1200 / 5\n",
|
|
|
+ "... second_cell = True\n",
|
|
|
+ "... \n",
|
|
|
+ "... if second_cell:\n",
|
|
|
+ "... print(result)\n",
|
|
|
+ "...\n",
|
|
|
+ ">>> ### Shift + Enter; then Alt + Enter ###\n",
|
|
|
+ "... \n",
|
|
|
+ "... welcome_message = 'Hello, Jupyter!'\n",
|
|
|
+ "... first_cell = True\n",
|
|
|
+ "... \n",
|
|
|
+ "... if first_cell:\n",
|
|
|
+ "... print(welcome_message)\n",
|
|
|
+ "... \n",
|
|
|
+ "... print('First cell')\n",
|
|
|
+ "...\n",
|
|
|
+ ">>> ### Ctrl + Enter ###\n",
|
|
|
+ "... \n",
|
|
|
+ "... print('Second cell')\n",
|
|
|
+ "...\n",
|
|
|
+ ">>> ### Ctrl + Enter ###\n",
|
|
|
+ "... \n",
|
|
|
+ "... result = 1200 / 5\n",
|
|
|
+ "... second_cell = True\n",
|
|
|
+ "... \n",
|
|
|
+ "... if second_cell:\n",
|
|
|
+ "... print(result)\n",
|
|
|
+ "... \n",
|
|
|
+ "... print('Third cell')\n",
|
|
|
+ "...\n",
|
|
|
+ ">>> welcome_message = 'Hello, Jupyter!'\n",
|
|
|
+ "... first_cell = True\n",
|
|
|
+ "... \n",
|
|
|
+ "... if first_cell:\n",
|
|
|
+ "... print(welcome_message)\n",
|
|
|
+ "... \n",
|
|
|
+ "... print('First cell')\n",
|
|
|
+ "...\n",
|
|
|
+ ">>> result = 1200 / 5\n",
|
|
|
+ "... second_cell = True\n",
|
|
|
+ "... \n",
|
|
|
+ "... if second_cell:\n",
|
|
|
+ "... print(result)\n",
|
|
|
+ "... \n",
|
|
|
+ "... print('Second cell')\n",
|
|
|
+ "...\n",
|
|
|
+ ">>> print('A true third cell')\n",
|
|
|
+ ">>> def welcome(a_string):\n",
|
|
|
+ "... print('Welcome to ' + a_string + '!')\n",
|
|
|
+ "... \n",
|
|
|
+ "... dq = 'Dataquest'\n",
|
|
|
+ "... jn = 'Jupyter Notebook'\n",
|
|
|
+ "... py = 'Python'\n",
|
|
|
+ "...\n",
|
|
|
+ ">>> welcome(dq)\n",
|
|
|
+ "... welcome(jn)\n",
|
|
|
+ "... welcome(py)\n",
|
|
|
+ "...\n",
|
|
|
+ ">>> %history -p\n",
|
|
|
+ ">>> # Restart & Clear Output\n",
|
|
|
+ ">>> '''\n",
|
|
|
+ "... Note: To reproduce exactly the output in this notebook\n",
|
|
|
+ "... as whole:\n",
|
|
|
+ "... \n",
|
|
|
+ "... 1. Run all the cells above.\n",
|
|
|
+ "... 2. Restart the program's state but keep the output\n",
|
|
|
+ "... (click Restart Kernel).\n",
|
|
|
+ "... 3. Then, run only the cells below.\n",
|
|
|
+ "... \n",
|
|
|
+ "... \n",
|
|
|
+ "... (You were not asked in this exercise to write a note like this.\n",
|
|
|
+ "... The note above was written to give more details on how to reproduce\n",
|
|
|
+ "... the behavior seen in this notebook.)\n",
|
|
|
+ "... '''\n",
|
|
|
+ "...\n",
|
|
|
">>> %history -p\n"
|
|
|
]
|
|
|
}
|
|
@@ -381,7 +473,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 4,
|
|
|
+ "execution_count": 15,
|
|
|
"metadata": {},
|
|
|
"outputs": [],
|
|
|
"source": [
|
|
@@ -395,17 +487,18 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 3,
|
|
|
+ "execution_count": 16,
|
|
|
"metadata": {},
|
|
|
"outputs": [
|
|
|
{
|
|
|
- "name": "stdout",
|
|
|
- "output_type": "stream",
|
|
|
- "text": [
|
|
|
- "Welcome to Dataquest!\n",
|
|
|
- "Welcome to Jupyter Notebook!\n",
|
|
|
- "Welcome to Python!\n"
|
|
|
- ]
|
|
|
+ "data": {
|
|
|
+ "text/plain": [
|
|
|
+ "'Welcome to Python!'"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ "execution_count": 16,
|
|
|
+ "metadata": {},
|
|
|
+ "output_type": "execute_result"
|
|
|
}
|
|
|
],
|
|
|
"source": [
|
|
@@ -416,14 +509,66 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 5,
|
|
|
+ "execution_count": 17,
|
|
|
"metadata": {},
|
|
|
"outputs": [
|
|
|
{
|
|
|
"name": "stdout",
|
|
|
"output_type": "stream",
|
|
|
"text": [
|
|
|
- ">>> %history -p\n",
|
|
|
+ ">>> welcome_message = 'Hello, Jupyter!'\n",
|
|
|
+ "... first_cell = True\n",
|
|
|
+ "... \n",
|
|
|
+ "... if first_cell:\n",
|
|
|
+ "... print(welcome_message)\n",
|
|
|
+ "...\n",
|
|
|
+ ">>> result = 1200 / 5\n",
|
|
|
+ "... second_cell = True\n",
|
|
|
+ "... \n",
|
|
|
+ "... if second_cell:\n",
|
|
|
+ "... print(result)\n",
|
|
|
+ "...\n",
|
|
|
+ ">>> ### Shift + Enter; then Alt + Enter ###\n",
|
|
|
+ "... \n",
|
|
|
+ "... welcome_message = 'Hello, Jupyter!'\n",
|
|
|
+ "... first_cell = True\n",
|
|
|
+ "... \n",
|
|
|
+ "... if first_cell:\n",
|
|
|
+ "... print(welcome_message)\n",
|
|
|
+ "... \n",
|
|
|
+ "... print('First cell')\n",
|
|
|
+ "...\n",
|
|
|
+ ">>> ### Ctrl + Enter ###\n",
|
|
|
+ "... \n",
|
|
|
+ "... print('Second cell')\n",
|
|
|
+ "...\n",
|
|
|
+ ">>> ### Ctrl + Enter ###\n",
|
|
|
+ "... \n",
|
|
|
+ "... result = 1200 / 5\n",
|
|
|
+ "... second_cell = True\n",
|
|
|
+ "... \n",
|
|
|
+ "... if second_cell:\n",
|
|
|
+ "... print(result)\n",
|
|
|
+ "... \n",
|
|
|
+ "... print('Third cell')\n",
|
|
|
+ "...\n",
|
|
|
+ ">>> welcome_message = 'Hello, Jupyter!'\n",
|
|
|
+ "... first_cell = True\n",
|
|
|
+ "... \n",
|
|
|
+ "... if first_cell:\n",
|
|
|
+ "... print(welcome_message)\n",
|
|
|
+ "... \n",
|
|
|
+ "... print('First cell')\n",
|
|
|
+ "...\n",
|
|
|
+ ">>> result = 1200 / 5\n",
|
|
|
+ "... second_cell = True\n",
|
|
|
+ "... \n",
|
|
|
+ "... if second_cell:\n",
|
|
|
+ "... print(result)\n",
|
|
|
+ "... \n",
|
|
|
+ "... print('Second cell')\n",
|
|
|
+ "...\n",
|
|
|
+ ">>> print('A true third cell')\n",
|
|
|
">>> def welcome(a_string):\n",
|
|
|
"... print('Welcome to ' + a_string + '!')\n",
|
|
|
"... \n",
|
|
@@ -435,6 +580,24 @@
|
|
|
"... welcome(jn)\n",
|
|
|
"... welcome(py)\n",
|
|
|
"...\n",
|
|
|
+ ">>> %history -p\n",
|
|
|
+ ">>> # Restart & Clear Output\n",
|
|
|
+ ">>> '''\n",
|
|
|
+ "... Note: To reproduce exactly the output in this notebook\n",
|
|
|
+ "... as whole:\n",
|
|
|
+ "... \n",
|
|
|
+ "... 1. Run all the cells above.\n",
|
|
|
+ "... 2. Restart the program's state but keep the output\n",
|
|
|
+ "... (click Restart Kernel).\n",
|
|
|
+ "... 3. Then, run only the cells below.\n",
|
|
|
+ "... \n",
|
|
|
+ "... \n",
|
|
|
+ "... (You were not asked in this exercise to write a note like this.\n",
|
|
|
+ "... The note above was written to give more details on how to reproduce\n",
|
|
|
+ "... the behavior seen in this notebook.)\n",
|
|
|
+ "... '''\n",
|
|
|
+ "...\n",
|
|
|
+ ">>> %history -p\n",
|
|
|
">>> def welcome(a_string):\n",
|
|
|
"... welcome_msg = 'Welcome to ' + a_string + '!'\n",
|
|
|
"... return welcome_msg\n",
|
|
@@ -442,6 +605,10 @@
|
|
|
"... dq = 'Dataquest'\n",
|
|
|
"... jn = 'Jupyter Notebook'\n",
|
|
|
"...\n",
|
|
|
+ ">>> welcome(dq)\n",
|
|
|
+ "... welcome(jn)\n",
|
|
|
+ "... welcome(py)\n",
|
|
|
+ "...\n",
|
|
|
">>> %history -p\n"
|
|
|
]
|
|
|
}
|
|
@@ -452,7 +619,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 6,
|
|
|
+ "execution_count": 18,
|
|
|
"metadata": {},
|
|
|
"outputs": [
|
|
|
{
|
|
@@ -461,7 +628,7 @@
|
|
|
"'Welcome to Python!'"
|
|
|
]
|
|
|
},
|
|
|
- "execution_count": 6,
|
|
|
+ "execution_count": 18,
|
|
|
"metadata": {},
|
|
|
"output_type": "execute_result"
|
|
|
}
|
|
@@ -494,7 +661,7 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "code",
|
|
|
- "execution_count": 7,
|
|
|
+ "execution_count": 19,
|
|
|
"metadata": {},
|
|
|
"outputs": [
|
|
|
{
|
|
@@ -566,7 +733,7 @@
|
|
|
" '1']]"
|
|
|
]
|
|
|
},
|
|
|
- "execution_count": 7,
|
|
|
+ "execution_count": 19,
|
|
|
"metadata": {},
|
|
|
"output_type": "execute_result"
|
|
|
}
|
|
@@ -625,7 +792,7 @@
|
|
|
"name": "python",
|
|
|
"nbconvert_exporter": "python",
|
|
|
"pygments_lexer": "ipython3",
|
|
|
- "version": "3.6.4"
|
|
|
+ "version": "3.8.2"
|
|
|
}
|
|
|
},
|
|
|
"nbformat": 4,
|