Browse Source

Some comments and a fix to week 2 discovered by Bill G.

pull/12/head
Edward Donner 6 months ago
parent
commit
6ba1875cd3
  1. 140
      week1/Guide to Jupyter.ipynb
  2. 2
      week1/troubleshooting.ipynb
  3. 12
      week2/day2.ipynb

140
week1/Guide to Jupyter.ipynb

@ -0,0 +1,140 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "5c291475-8c7c-461c-9b12-545a887b2432",
"metadata": {},
"source": [
"# Jupyter Lab\n",
"\n",
"## A Quick Start Guide\n",
"\n",
"Welcome to the wonderful world of Jupyter lab! \n",
"This is a Data Science playground where you can easily write code that builds and builds. It's an ideal environment for: \n",
"- Research & Development\n",
"- Prototyping\n",
"- Learning (that's us!)\n",
"\n",
"It's not typically used for shipping production code, and in Week 8 we'll explore the bridge between Jupyter and python code.\n",
"\n",
"A file in Jupyter Lab, like this one, is called a **Notebook**.\n",
"\n",
"A long time ago, Jupyter used to be called \"IPython\", and so the extensions of notebooks are \".ipynb\" which stands for \"IPython Notebook\".\n",
"\n",
"On the left is a File Browser that lets you navigate around the weeks and choose different notebooks. But you probably know that already, or you wouldn't have got here!\n",
"\n",
"The notebook consists of a series of square boxes called \"cells\". Some of them contain text, like this cell, and some of them contain code, like the cell below.\n",
"\n",
"Click in a cell with code and press `Shift + Return` (or `Shift + Enter`) to run the code and print the output.\n",
"\n",
"Do that now for the cell below this:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "33d37cd8-55c9-4e03-868c-34aa9cab2c80",
"metadata": {},
"outputs": [],
"source": [
"2 + 2"
]
},
{
"cell_type": "markdown",
"id": "9e95df7b-55c6-4204-b8f9-cae83360fc23",
"metadata": {},
"source": [
"## Congrats!\n",
"\n",
"Now run the next cell which sets a value, followed by the cell after it to print the value"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "585eb9c1-85ee-4c27-8dc2-b4d8d022eda0",
"metadata": {},
"outputs": [],
"source": [
"# Set a value for a variable\n",
"\n",
"favorite_fruit = \"bananas\""
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a067d2b1-53d5-4aeb-8a3c-574d39ff654a",
"metadata": {},
"outputs": [],
"source": [
"# Use the variable\n",
"\n",
"print(f\"My favorite fruit is {favorite_fruit}\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4c5a4e60-b7f4-4953-9e80-6d84ba4664ad",
"metadata": {},
"outputs": [],
"source": [
"# Now change the variable\n",
"\n",
"favorite_fruit = f\"anything but {favorite_fruit}\""
]
},
{
"cell_type": "markdown",
"id": "9442d5c9-f57d-4839-b0af-dce58646c04f",
"metadata": {},
"source": [
"# Now go back and rerun the prior cell with the print statement\n",
"\n",
"See how it prints something different, even though favorite_fruit was changed afterwards? \n",
"The order that code appears in the notebook doesn't matter. What matters is the order that the code is **executed**."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8e5ec81d-7c5b-4025-bd2e-468d67b581b6",
"metadata": {},
"outputs": [],
"source": [
"# More coming here soon!"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b51950ca-b512-4829-974f-442bd50e29a5",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

2
week1/troubleshooting.ipynb

@ -222,7 +222,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "42165c99-ec20-460b-b94d-ea1da25b2a0a", "id": "32dea02e-c216-4aed-9f84-934c981d0573",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []

12
week2/day2.ipynb

@ -397,7 +397,9 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"system_prompt = \"You are an assistant that analyzes the contents of a company website landing page \\\n", "# With massive thanks to Bill G. who noticed that a prior version of this had a bug! Now fixed.\n",
"\n",
"system_message = \"You are an assistant that analyzes the contents of a company website landing page \\\n",
"and creates a short brochure about the company for prospective customers, investors and recruits. Respond in markdown.\"" "and creates a short brochure about the company for prospective customers, investors and recruits. Respond in markdown.\""
] ]
}, },
@ -438,6 +440,14 @@
")\n", ")\n",
"view.launch()" "view.launch()"
] ]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ede97ca3-a0f8-4f6e-be17-d1de7fef9cc0",
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {

Loading…
Cancel
Save