You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
4
+
5
+
## Raising an Issue to Encourage a Contribution
6
+
7
+
If you notice a problem with the curriculum that you believe needs improvement
8
+
but you're unable to make the change yourself, you should raise a Github issue
9
+
containing a clear description of the problem. Include relevant snippets of
10
+
the content and/or screenshots if applicable. Curriculum owners regularly review
11
+
issue lists and your issue will be prioritized and addressed as appropriate.
12
+
13
+
## Submitting a Pull Request to Suggest an Improvement
14
+
15
+
If you see an opportunity for improvement and can make the change yourself go
16
+
ahead and use a typical git workflow to make it happen:
17
+
18
+
* Fork this curriculum repository
19
+
* Make the change on your fork, with descriptive commits in the standard format
20
+
* Open a Pull Request against this repo
21
+
22
+
A curriculum owner will review your change and approve or comment on it in due
23
+
course.
24
+
25
+
# Why Contribute?
26
+
27
+
Curriculum on Learn is publicly and freely available under Learn's
28
+
[Educational Content License](https://learn.co/content-license). By
29
+
embracing an open-source contribution model, our goal is for the curriculum
30
+
on Learn to become, in time, the best educational content the world has
31
+
ever seen.
32
+
33
+
We need help from the community of Learners to maintain and improve the
34
+
educational content. Everything from fixing typos, to correcting
35
+
out-dated information, to improving exposition, to adding better examples,
36
+
to fixing tests—all contributions to making the curriculum more effective are
Copy file name to clipboardExpand all lines: README.md
+21-11Lines changed: 21 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
4
4
### Introduction
5
5
6
-
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.
6
+
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.
7
7
8
8
### Jupyter Background
9
9
@@ -27,15 +27,19 @@ If we wish to quickly add a new cell we can do so with the following steps:
27
27
28
28
* Make sure we are not in insert mode, but in escape mode
29
29
**Remember we can tell we are in insert mode when we have a green border around our cell.*
30
-
* To get out of insert mode and into escape mode, press the escape key.
30
+
* To get out of insert mode and into escape mode, press shift + enter. Another option is to press the escape key.
31
31
* You will no longer see a cell bordered in green.
32
-
* Then press the letter `b`
32
+
* Then press the letter `b` to create a new cell.
33
33
34
34
#### Deleting cells
35
35
36
36
To delete a cell we once again should be in escape mode, and then press the `x` key.
37
37
38
-
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.
38
+
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.
39
+
40
+
Go to escape mode and press `x`. This cell disappears!
41
+
42
+
Then bring it back with `z`.
39
43
40
44
### Types of Cells
41
45
@@ -45,25 +49,31 @@ Cells can also have a type of code. If we are writing in a cell that is for Pyt
45
49
46
50
47
51
```python
48
-
This is a python cell without valid Python so we wil see an error
52
+
This is a python cell without valid Python so we will see an error
49
53
```
50
54
51
55
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.
52
56
53
-
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.
57
+
From escape mode, we change a cell to type code by pressing the letter `y`.
58
+
59
+
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.
60
+
61
+
#### View All Shortcuts
62
+
63
+
Press the key `h` while in escape mode to view the menu for all of Jupyter's shortcuts.
54
64
55
65
### Working with Python in Jupyter
56
66
57
67
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.
58
68
59
-
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.
69
+
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.
60
70
61
71
62
72
```python
63
73
name ='bob'
64
74
```
65
75
66
-
If we try to reference that variable later on withouth having run it, Python will tell us that it is not defined.
76
+
If we try to reference that variable later on without having executed the cell, Python will tell us that it is not defined.
67
77
68
78
69
79
```python
@@ -75,7 +85,7 @@ name
75
85
76
86
NameError Traceback (most recent call last)
77
87
78
-
<ipython-input-1-18697449d7c4> in <module>()
88
+
<ipython-input-4-9bc0cb2ed6de> in <module>()
79
89
----> 1 name
80
90
81
91
@@ -99,7 +109,7 @@ age
99
109
100
110
As you can see the variable `age` is set to 14, so when the cell is run `14` is displayed underneath.
101
111
102
-
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.
112
+
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.
103
113
104
114
105
115
```python
@@ -135,6 +145,6 @@ The same thing goes for working through a Readme. The Readmes will often assign
135
145
136
146
### Summary
137
147
138
-
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`.
148
+
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`.
139
149
140
150
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.
Copy file name to clipboardExpand all lines: index.ipynb
+26-11Lines changed: 26 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@
18
18
"cell_type": "markdown",
19
19
"metadata": {},
20
20
"source": [
21
-
"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."
21
+
"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."
22
22
]
23
23
},
24
24
{
@@ -100,7 +100,11 @@
100
100
"source": [
101
101
"To delete a cell we once again should be in escape mode, and then press the `x` key.\n",
102
102
"\n",
103
-
"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."
103
+
"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",
104
+
"\n",
105
+
"Go to escape mode and press `x`. This cell disappears!\n",
106
+
"\n",
107
+
"Then bring it back with `z`."
104
108
]
105
109
},
106
110
{
@@ -122,7 +126,7 @@
122
126
},
123
127
"outputs": [],
124
128
"source": [
125
-
"This is a python cell without valid Python so we wil see an error"
129
+
"This is a python cell without valid Python so we will see an error"
126
130
]
127
131
},
128
132
{
@@ -133,7 +137,18 @@
133
137
"source": [
134
138
"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",
135
139
"\n",
136
-
"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."
140
+
"From escape mode, we change a cell to type code by pressing the letter `y`.\n",
141
+
"\n",
142
+
"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."
143
+
]
144
+
},
145
+
{
146
+
"cell_type": "markdown",
147
+
"metadata": {},
148
+
"source": [
149
+
"#### View All Shortcuts\n",
150
+
"\n",
151
+
"Press the key `h` while in escape mode to view the menu for all of Jupyter's shortcuts."
137
152
]
138
153
},
139
154
{
@@ -154,7 +169,7 @@
154
169
"cell_type": "markdown",
155
170
"metadata": {},
156
171
"source": [
157
-
"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."
172
+
"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."
158
173
]
159
174
},
160
175
{
@@ -172,12 +187,12 @@
172
187
"cell_type": "markdown",
173
188
"metadata": {},
174
189
"source": [
175
-
"If we try to reference that variable later on withouth having run it, Python will tell us that it is not defined. "
190
+
"If we try to reference that variable later on without having executed the cell, Python will tell us that it is not defined. "
"\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",
205
+
"\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",
191
206
"\u001b[0;31mNameError\u001b[0m: name 'name' is not defined"
192
207
]
193
208
}
@@ -230,7 +245,7 @@
230
245
"source": [
231
246
"As you can see the variable `age` is set to 14, so when the cell is run `14` is displayed underneath.\n",
232
247
"\n",
233
-
"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. "
248
+
"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. "
234
249
]
235
250
},
236
251
{
@@ -316,7 +331,7 @@
316
331
"cell_type": "markdown",
317
332
"metadata": {},
318
333
"source": [
319
-
"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",
334
+
"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",
320
335
"\n",
321
336
"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."
0 commit comments