Skip to content

Main #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
192 changes: 192 additions & 0 deletions index copy.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Running Jupyter Notebooks Locally - Lab"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Introduction\n",
"Now that we have had an introduction to the command line, have seen how to clone GitHub repos to our local machine (our computer), and have seen some common Jupyter Notebook operations, it's time to put our skills to the test!"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Objectives\n",
"You will be able to:\n",
"* Use basic commands to navigate the command line\n",
"* Use bash commands to create new files and folders\n",
"* Use `git clone` to clone a repository\n",
"* Perform cell operations within Jupyter Notebooks"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Setup\n",
"\n",
"Remember from the last lesson, you need to:\n",
"1. Click on the \"GitHub\" logo in the top right of the Canvas Assignment (go back to the previous page if you already loaded the Lab in SaturnCloud!)\n",
"2. Fork the repository on GitHub so you have your own copy there\n",
"3. Copy the URL of your repository\n",
"4. Open a terminal window (terminal on a Mac, Git Bash on Windows)\n",
"5. Make sure to activate your conda virtual environment so you have the right version of Python and all of the necessary packages. On a mac or in Git Bash on Windows, type `conda activate learn-env`. (If you *have* to use the conda shell on windows, type `activate learn-env` instead).\n",
"6. Clone (download) the files to your hard drive by typing `git clone ` and then pasting the URL of your repo you saved in step 3.\n",
"7. Type `cd ` followed by the name of the directory you just created (running the `ls` command will show you the name of the directory you downloaded) \n",
"7. Run the `jupyter notebook` command to start up Jupyter, and in the browser window that opens, navigate to and click on the `index.ipynb` notebook."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Instructions"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Assign the below variable `number` to the number `42` by replacing `None` with `42`."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"42"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"number = 42\n",
"number"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Next, like the above, reassign the `flatiron_mantra` variable with the string `\"Change Things\"` (make sure to include the double quotes!) "
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Change Things'"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"flatiron_mantra = \"Change Things\"\n",
"flatiron_mantra"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Add a new markdown cell below this one and type `### This is a new header`"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### This is a new header"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now add a new code cell below this one and write whatever code you want to write."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Kindly input your first name Louis\n",
"Kindly input your second name Ragen\n",
"Hi Louis Ragen thank you for participating\n"
]
}
],
"source": [
"name1 = input(\"Kindly input your first name \")\n",
"name2 = input(\"Kindly input your second name \")\n",
"allnames = name1 +\" \"+ name2\n",
"print(f\"Hi {allnames} thank you for participating\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"As you can see, this works just the same as editing Jupyter notebooks using cloud tools, only now it's on your computer."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Summary\n",
"Great work! We are well on our way to mastering Jupyter notebooks! We reviewed using the command line and `git clone`, running cells, and checking our outputs."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
67 changes: 60 additions & 7 deletions index.ipynb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"cells": [
{
"cell_type": "markdown",
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Running Jupyter Notebooks Locally - Lab"
]
Expand Down Expand Up @@ -60,11 +62,22 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"42"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"number = None\n",
"number = 42\n",
"number"
]
},
Expand All @@ -77,11 +90,22 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"'Change Things'"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"flatiron_mantra = None\n",
"flatiron_mantra = \"Change Things\"\n",
"flatiron_mantra"
]
},
Expand All @@ -92,13 +116,42 @@
"Add a new markdown cell below this one and type `### This is a new header`"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### This is a new header"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now add a new code cell below this one and write whatever code you want to write."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Kindly input your first name Louis\n",
"Kindly input your second name Ragen\n",
"Hi Louis Ragen thank you for participating\n"
]
}
],
"source": [
"name1 = input(\"Kindly input your first name \")\n",
"name2 = input(\"Kindly input your second name \")\n",
"allnames = name1 +\" \"+ name2\n",
"print(f\"Hi {allnames} thank you for participating\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down