Skip to content

Commit

Permalink
resolved issues learn-co-students#1, learn-co-students#2, #5, #6, #7,…
Browse files Browse the repository at this point in the history
… #8, add license/contrib
  • Loading branch information
cutterbuck committed Jun 20, 2018
1 parent b943429 commit 0ae0cba
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 22 deletions.
37 changes: 37 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Contributing to Learn.co Curriculum

We're really exited that you're about to contribute to the [open curriculum](https://learn.co/content-license) on [Learn.co](https://learn.co). If this is your first time contributing, please continue reading to learn how to make the most meaningful and useful impact possible.

## Raising an Issue to Encourage a Contribution

If you notice a problem with the curriculum that you believe needs improvement
but you're unable to make the change yourself, you should raise a Github issue
containing a clear description of the problem. Include relevant snippets of
the content and/or screenshots if applicable. Curriculum owners regularly review
issue lists and your issue will be prioritized and addressed as appropriate.

## Submitting a Pull Request to Suggest an Improvement

If you see an opportunity for improvement and can make the change yourself go
ahead and use a typical git workflow to make it happen:

* Fork this curriculum repository
* Make the change on your fork, with descriptive commits in the standard format
* Open a Pull Request against this repo

A curriculum owner will review your change and approve or comment on it in due
course.

# Why Contribute?

Curriculum on Learn is publicly and freely available under Learn's
[Educational Content License](https://learn.co/content-license). By
embracing an open-source contribution model, our goal is for the curriculum
on Learn to become, in time, the best educational content the world has
ever seen.

We need help from the community of Learners to maintain and improve the
educational content. Everything from fixing typos, to correcting
out-dated information, to improving exposition, to adding better examples,
to fixing tests—all contributions to making the curriculum more effective are
welcome.
23 changes: 23 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Learn.co Educational Content License

Copyright (c) 2018 Flatiron School, Inc

The Flatiron School, Inc. owns this Educational Content. However, the Flatiron
School supports the development and availability of educational materials in
the public domain. Therefore, the Flatiron School grants Users of the Flatiron
Educational Content set forth in this repository certain rights to reuse, build
upon and share such Educational Content subject to the terms of the Educational
Content License set forth [here](http://learn.co/content-license)
(http://learn.co/content-license). You must read carefully the terms and
conditions contained in the Educational Content License as such terms govern
access to and use of the Educational Content.

Flatiron School is willing to allow you access to and use of the Educational
Content only on the condition that you accept all of the terms and conditions
contained in the Educational Content License set forth
[here](http://learn.co/content-license) (http://learn.co/content-license). By
accessing and/or using the Educational Content, you are agreeing to all of the
terms and conditions contained in the Educational Content License. If you do
not agree to any or all of the terms of the Educational Content License, you
are prohibited from accessing, reviewing or using in any way the Educational
Content.
32 changes: 21 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

### Introduction

So far, many of the readings and all of the labs you have been working with have been interactive. You are working in an environment that allows us to both display text, and run Python code. In this lesson, we explore Jupyter, the software powering these interactive documents.
So far, many of the readings and all of the labs you have been working with have been interactive. You are working in an environment that allows us to both display text and run Python code. In this lesson, we explore Jupyter, the software powering these interactive documents.

### Jupyter Background

Expand All @@ -27,15 +27,19 @@ If we wish to quickly add a new cell we can do so with the following steps:

* Make sure we are not in insert mode, but in escape mode
* *Remember we can tell we are in insert mode when we have a green border around our cell.*
* To get out of insert mode and into escape mode, press the escape key.
* To get out of insert mode and into escape mode, press shift + enter. Another option is to press the escape key.
* You will no longer see a cell bordered in green.
* Then press the letter `b`
* Then press the letter `b` to create a new cell.

#### Deleting cells

To delete a cell we once again should be in escape mode, and then press the `x` key.

Of course, we'll want a way to undo our deletion. You can press d to undo deletion of a cell. Note that this is different from `cmd + z`. Pressing `cmd + z` undoes our changes inside of a cell, but pressing `d` from escape mode is to undo changing a cell in it's entirety.
Of course, we'll want a way to undo our deletion. From escape mode, you can press `z` to undo deletion of a cell. Note that this is different from `cmd + z`. Pressing `cmd + z` while in insert mode undoes any changes inside of a cell while, whether these changes be deletions or text insertions. Pressing `z` from escape mode undoes the deletion a cell.

Go to escape mode and press `x`. This cell disappears!

Then bring it back with `z`.

### Types of Cells

Expand All @@ -45,25 +49,31 @@ Cells can also have a type of code. If we are writing in a cell that is for Pyt


```python
This is a python cell without valid Python so we wil see an error
This is a python cell without valid Python so we will see an error
```

So, a cell must either be of type markdown or of type code, in which case all of the contents must be valid Python. It cannot be both. We can quickly change a cell from markdown to code with some keyboard shortcuts.

From escape mode, we change a cell to type code by pressing the letter `y`. Add a new cell by pressing the letter `b`, then type `j` to change that cell into type code. Again, press `shift + enter` to save the changes of the cell. From escape mode, press the letter `m` to change the cell from code to markdown.
From escape mode, we change a cell to type code by pressing the letter `y`.

Anytime we create a new cell, say with the shortcut key `b`, the new cell will default to code mode. We can switch to escape mode and press the letter `m` to change the cell from code to markdown.

#### View All Shortcuts

Press the key `h` while in escape mode to view the menu for all of Jupyter's shortcuts.

### Working with Python in Jupyter

Ok, now that we know a little bit about adding and deleting cells, as well as changing cell types from markdown to code, let's focus on working with Python in Jupyter. We'll go into a large amount of detail about working with a Jupyter notebook in Python, but the main takeaway is this: if we see a Python cell, we should press `shift + enter` on that cell.

The major gotcha in working with Python code is that Python will only execute the cells that are run. So for example, just seeing the cell where we define `name` to `'bob'` below does not write that cell to memory.
The major gotcha in working with Python code is that we must execute the cells in order for Python to register the code in them. So for example, just seeing the cell where we define `name` to `'bob'` below does not write that cell to memory.


```python
name = 'bob'
```

If we try to reference that variable later on withouth having run it, Python will tell us that it is not defined.
If we try to reference that variable later on without having executed the cell, Python will tell us that it is not defined.


```python
Expand All @@ -75,7 +85,7 @@ name

NameError Traceback (most recent call last)

<ipython-input-1-18697449d7c4> in <module>()
<ipython-input-4-9bc0cb2ed6de> in <module>()
----> 1 name


Expand All @@ -99,7 +109,7 @@ age

As you can see the variable `age` is set to 14, so when the cell is run `14` is displayed underneath.

One tricky thing to note is that assignment, the action of assigning a varible, **does not** have a return a value. So, even though the cell is run, if the last line of cell is the assigning of a variable, nothing is displayed underneath.
One tricky thing to note is that assignment, the action of assigning a variable, **does not** have a return a value. So, even though the cell is run, if the last line of cell is the assigning of a variable, nothing is displayed underneath.


```python
Expand Down Expand Up @@ -135,6 +145,6 @@ The same thing goes for working through a Readme. The Readmes will often assign

### Summary

In this lesson, we learned about Jupyter notebooks. We saw that in Jupyter notebooks, we can either be in insert mode or escape mode. While in insert mode, we can edit the cells and undo changes within that cell with `command + z` or `ctl + z`. In escape mode, we can add cells with `b`, delete a cell with `x`, and undo deletion of a cell with `d`. We can also change the type of a cell to markdown with `m` and to Python code with `j`.
In this lesson, we learned about Jupyter notebooks. We saw that in Jupyter notebooks, we can either be in insert mode or escape mode. While in insert mode, we can edit the cells and undo changes within that cell with `cmd + z` on a mac or `ctl + z` on windows. In escape mode, we can add cells with `b`, delete a cell with `x`, and undo deletion of a cell with `z`. We can also change the type of a cell to markdown with `m` and to Python code with `y`.

Then we saw how to work with Python code in Jupyter notebooks. We saw that to have our code in a cell executed, we need to press `shift + enter`. If we do not do this, then our variables that we assigned in Python are not going to be recognized by Python later on in our Jupyter notebook.
37 changes: 26 additions & 11 deletions index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"So far, many of the readings and all of the labs you have been working with have been interactive. You are working in an environment that allows us to both display text, and run Python code. In this lesson, we explore Jupyter, the software powering these interactive documents."
"So far, many of the readings and all of the labs you have been working with have been interactive. You are working in an environment that allows us to both display text and run Python code. In this lesson, we explore Jupyter, the software powering these interactive documents."
]
},
{
Expand Down Expand Up @@ -100,7 +100,11 @@
"source": [
"To delete a cell we once again should be in escape mode, and then press the `x` key.\n",
"\n",
"Of course, we'll want a way to undo our deletion. From escape mode, you can press z to undo deletion of a cell. Note that this is different from `cmd + z`. Pressing `cmd + z` undoes our changes inside of a cell, but pressing `d` from escape mode is to undo changing a cell in it's entirety."
"Of course, we'll want a way to undo our deletion. From escape mode, you can press `z` to undo deletion of a cell. Note that this is different from `cmd + z`. Pressing `cmd + z` while in insert mode undoes any changes inside of a cell while, whether these changes be deletions or text insertions. Pressing `z` from escape mode undoes the deletion a cell.\n",
"\n",
"Go to escape mode and press `x`. This cell disappears!\n",
"\n",
"Then bring it back with `z`."
]
},
{
Expand All @@ -122,7 +126,7 @@
},
"outputs": [],
"source": [
"This is a python cell without valid Python so we wil see an error"
"This is a python cell without valid Python so we will see an error"
]
},
{
Expand All @@ -133,7 +137,18 @@
"source": [
"So, a cell must either be of type markdown or of type code, in which case all of the contents must be valid Python. It cannot be both. We can quickly change a cell from markdown to code with some keyboard shortcuts.\n",
"\n",
"From escape mode, we change a cell to type code by pressing the letter `y`. Add a new cell by pressing the letter `b`, then type `j` to change that cell into type code. Again, press `shift + enter` to save the changes of the cell. From escape mode, press the letter `m` to change the cell from code to markdown."
"From escape mode, we change a cell to type code by pressing the letter `y`.\n",
"\n",
"Anytime we create a new cell, say with the shortcut key `b`, the new cell will default to code mode. We can switch to escape mode and press the letter `m` to change the cell from code to markdown."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### View All Shortcuts\n",
"\n",
"Press the key `h` while in escape mode to view the menu for all of Jupyter's shortcuts."
]
},
{
Expand All @@ -154,7 +169,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The major gotcha in working with Python code is that Python will only execute the cells that are run. So for example, just seeing the cell where we define `name` to `'bob'` below does not write that cell to memory."
"The major gotcha in working with Python code is that we must execute the cells in order for Python to register the code in them. So for example, just seeing the cell where we define `name` to `'bob'` below does not write that cell to memory."
]
},
{
Expand All @@ -172,12 +187,12 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"If we try to reference that variable later on withouth having run it, Python will tell us that it is not defined. "
"If we try to reference that variable later on without having executed the cell, Python will tell us that it is not defined. "
]
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 4,
"metadata": {},
"outputs": [
{
Expand All @@ -187,7 +202,7 @@
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-1-18697449d7c4>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mname\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m<ipython-input-4-9bc0cb2ed6de>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mname\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mNameError\u001b[0m: name 'name' is not defined"
]
}
Expand Down Expand Up @@ -230,7 +245,7 @@
"source": [
"As you can see the variable `age` is set to 14, so when the cell is run `14` is displayed underneath.\n",
"\n",
"One tricky thing to note is that assignment, the action of assigning a varible, **does not** have a return a value. So, even though the cell is run, if the last line of cell is the assigning of a variable, nothing is displayed underneath. "
"One tricky thing to note is that assignment, the action of assigning a variable, **does not** have a return a value. So, even though the cell is run, if the last line of cell is the assigning of a variable, nothing is displayed underneath. "
]
},
{
Expand Down Expand Up @@ -316,7 +331,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"In this lesson, we learned about Jupyter notebooks. We saw that in Jupyter notebooks, we can either be in insert mode or escape mode. While in insert mode, we can edit the cells and undo changes within that cell with `command + z` or `ctl + z`. In escape mode, we can add cells with `b`, delete a cell with `x`, and undo deletion of a cell with `d`. We can also change the type of a cell to markdown with `m` and to Python code with `j`. \n",
"In this lesson, we learned about Jupyter notebooks. We saw that in Jupyter notebooks, we can either be in insert mode or escape mode. While in insert mode, we can edit the cells and undo changes within that cell with `cmd + z` on a mac or `ctl + z` on windows. In escape mode, we can add cells with `b`, delete a cell with `x`, and undo deletion of a cell with `z`. We can also change the type of a cell to markdown with `m` and to Python code with `y`. \n",
"\n",
"Then we saw how to work with Python code in Jupyter notebooks. We saw that to have our code in a cell executed, we need to press `shift + enter`. If we do not do this, then our variables that we assigned in Python are not going to be recognized by Python later on in our Jupyter notebook."
]
Expand All @@ -338,7 +353,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.1"
"version": "3.6.4"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 0ae0cba

Please sign in to comment.