You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

140 lines
3.8 KiB

{
"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
}