Skip to content

Commit 057fc3d

Browse files
committed
Fixing typos, updating voice, and consolidating directions to be more motivating and realalistic.
1 parent a93bd5e commit 057fc3d

File tree

2 files changed

+48
-89
lines changed

2 files changed

+48
-89
lines changed

README.md

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,91 @@
11

2-
# Practice with datatypes
2+
# Practice with Data Types
33

44
### Introduction
55

6-
In the past few lessons, we have learned about working with different types of data in Python: strings, numbers (ints and floats), and booleans. Now let's put that knowledge into action.
6+
In the past few lessons,you learned about working with different types of data in Python: strings, numbers (ints and floats), and booleans. Now, you'll put that knowledge into action.
77

8-
In this lesson we'll imagine that we were at a nice social gathering and exchanged business cards with a few people. One of the business cards belongs to Art Vandelay, a new travel agent. We want to use our programming skills to format this information correctly.
8+
Imagine that you're at a business event and exchanged business cards with a few people. One of the business cards belongs to Art Vandelay, a new travel agent. Here, you'll use your programming skills to format this information correctly.
99

1010
### Learning Objectives
1111
* Manipulate strings with built-in methods
1212
* Practice coercing data types and changing numbers
1313

1414
### Here to mingle
1515

16-
The next morning we take out the business card, ready to format it using our programming skills, and here is what we find.
16+
The next morning you take out the business card, ready to format it using your programming skills, and here is what we find.
1717

1818
![](https://learn-verified.s3.amazonaws.com/data-science-assets/biz-card-mistakes.jpg)
1919

20-
Yeah, Mr. Vandelay may not be the best person to get to know or the best at designing business cards, but like Mr. Vandelay, we know that people enter incorrect information on forms all the time.
20+
### String Transformations
2121

22-
So as data scientists, we often need to clean and organize data before we can make sense of it. Let's get to work.
22+
When storing text in a spreadsheet or database programmatically, you will often preprocess the data to ensure that it is properly formatted. For example, you might ensure that a telephone number matches the required format, or that a field on a web form is filled out.
2323

24-
### Solving our first lab
25-
26-
This is our first lab, and here we'll see that there is some data already provided for us. Next to the data, we will see a comment indicating what the data should look like after we change it.
27-
28-
For example, let's say we want to capitalize all of the letters of "art vandlay". We'll see the following:
24+
Here's a simple example of how you might go about doing this:
2925

3026

3127
```python
32-
"art vandelay" # "ART VANDELAY"
28+
name = "art vandelay" # "ART VANDELAY"
29+
name.upper()
3330
```
3431

35-
Notice that there is no output below the gray code above. This is because Jupyter notebooks do not automatically run our code - so they do not automatically know the output. To display the output, we must **run** the code by clicking on the gray cell and then pressing shift + enter. Let's try it in the cell above and see our output appear below.
32+
If you haven't already, put your cursor into the cell above and press `shift + enter` to run the code in the cell. You should see an updated output produced by the `.upper()` string method.
3633

37-
Ok, once we see the output take a look at the cell below with the hash tag to the right of the string, `'hello'`. This is a comment like the above. Comments are used for programmers to annotate their code, but a comment has no impact on the code. We can see this by running the cell below (again, press shift + enter).
34+
Another important note is the hashtag `#`. In python, hashtags indicate a comment. Comments are notes used to provide additional information but are ignored by the computer when running the code.
3835

3936

4037
```python
4138
'hello' ### whattttt
4239
```
4340

44-
After pressing shift+enter on the cell above, we see that still Python happily ignores our comment. So here (and in future labs), a comment will be provided to indicate what we should see as the return value of our code. When we press shift+enter, and the output below matches the comment to the right of our code, we did it correctly.
45-
46-
> In future labs, Learn will check our code to ensure that we did it correctly. But for our first lab, this works fine.
47-
48-
To get our output to match the comment we will change it to the following:
49-
50-
51-
```python
52-
"art vandelay".upper() # 'ART VANDELAY'
53-
```
41+
After pressing shift+enter on the cell above, you'll see that Python ignores the comment. In Flatiron coding labs, a comment will be provided to indicate what you are aiming to have the code return. This allows you to then easily check your answer upon running your code.
5442

5543
### Get going with strings
5644

57-
First use the `title` method to capitalize the first letter of each word in "art vandelay"`.
45+
With that, use the appropriate string method to transform each string to match the desired output in the comment.
46+
47+
Use the `title` method to capitalize the first letter of each word in "art vandelay"`.
5848

5949

6050
```python
6151
"art vandelay" # 'Art Vandelay'
6252
```
6353

64-
Now let's uppercase all of the letters of "Ceo".
54+
Now use the `uppercase` method to capitalize all of the letters of "Ceo".
6555

6656

6757
```python
6858
"Ceo" # 'CEO'
6959
```
7060

71-
Next, write a method that answers a question about our email addresses. Every email address should end with ".com". We can use our knowledge of string methods to check if the email address ends with ".com" and return `True` or `False` accordingly.
61+
Next, write a method that verifies whether an email addresses is valid. To make this introductory example simple, assume that every email address should end with ".com". With that, use your knowledge of string methods to check if the email address ends with ".com" and return `True` or `False` accordingly.
7262

7363

7464
```python
7565
"art.vandelay@vandelay.co" # False
7666
```
7767

78-
As you can see below, the website "vandelay.com" is not preceded by `"www."`. We can perform what is called string concatenation to fix this! Use the plus sign, `'+'`, to change the website `'vandelay.com'` to the string `'www.vandelay.com'` by prepending `'www.'`.
68+
As you can see below, the website "vandelay.com" is not preceded by `"www."`. You can perform string concatenation to fix this! string concatenation allows you to join two strings. It works just like numerical addition. For example, ```"This is the start" + "and this is the end"``` would return ```"This is the start and this is the end"```. Use string concatenation to change the website `'vandelay.com'` to the string `'www.vandelay.com'` by prepending `'www.'`.
7969

8070

8171
```python
8272
'vandelay.com' # 'www.vandelay.com'
8373
```
8474

85-
### Working with numbers
75+
### String Slicing
8676

87-
Finally, Mr. Vandelay gave us his phone number, but he actually has two other phone numbers that are different from the one listed. All three numbers are basically the same with the exception of the ending. Below, start by coercing the first phone number, which is currently a string, to an `int` and add one. Next do the same to the second phone number but increase it by two.
77+
Finally, Mr. Vandelay gave us his phone number. Extract the area code by selecting the first three characters of the string. You can do this using brackets to select characters from the string as in ```"George"[:4]``` which would return ```"Geor"```.
8878

8979

9080
```python
91-
"7285553334" # 7285553335
81+
"7285553334" # 728
9282
```
9383

9484

9585
```python
96-
"7285553334" # 7285553336
86+
"7285553334" # 728
9787
```
9888

9989
### Summary
10090

101-
Our first lab is done! Sweet. In this lab, we practiced working with string methods to operate on and answer questions about strings. We wrote methods that return Booleans and changed strings to integers in order to perform addition. So much of working with data is ensuring that it is properly formatted so we can then operate on it, and in this lab, we saw how to use code to do just that.
91+
Congratulations! You just completed your first lab! You practiced working with string methods to operate on and answer questions about strings. You also used methods that return Booleans and sliced strings. So much of working with data is ensuring that it is properly formatted and in this lab, you started practicing your data wrangling skills.

index.ipynb

Lines changed: 25 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"# Practice with datatypes"
7+
"# Practice with Data Types"
88
]
99
},
1010
{
@@ -18,9 +18,9 @@
1818
"cell_type": "markdown",
1919
"metadata": {},
2020
"source": [
21-
"In the past few lessons, we have learned about working with different types of data in Python: strings, numbers (ints and floats), and booleans. Now let's put that knowledge into action.\n",
21+
"In the past few lessons,you learned about working with different types of data in Python: strings, numbers (ints and floats), and booleans. Now, you'll put that knowledge into action.\n",
2222
"\n",
23-
"In this lesson we'll imagine that we were at a nice social gathering and exchanged business cards with a few people. One of the business cards belongs to Art Vandelay, a new travel agent. We want to use our programming skills to format this information correctly. "
23+
"Imagine that you're at a business event and exchanged business cards with a few people. One of the business cards belongs to Art Vandelay, a new travel agent. Here, you'll use your programming skills to format this information correctly. "
2424
]
2525
},
2626
{
@@ -43,7 +43,7 @@
4343
"cell_type": "markdown",
4444
"metadata": {},
4545
"source": [
46-
"The next morning we take out the business card, ready to format it using our programming skills, and here is what we find."
46+
"The next morning you take out the business card, ready to format it using your programming skills, and here is what we find."
4747
]
4848
},
4949
{
@@ -57,25 +57,16 @@
5757
"cell_type": "markdown",
5858
"metadata": {},
5959
"source": [
60-
"Yeah, Mr. Vandelay may not be the best person to get to know or the best at designing business cards, but like Mr. Vandelay, we know that people enter incorrect information on forms all the time.\n",
61-
"\n",
62-
"So as data scientists, we often need to clean and organize data before we can make sense of it. Let's get to work. "
63-
]
64-
},
65-
{
66-
"cell_type": "markdown",
67-
"metadata": {},
68-
"source": [
69-
"### Solving our first lab"
60+
"### String Transformations"
7061
]
7162
},
7263
{
7364
"cell_type": "markdown",
7465
"metadata": {},
7566
"source": [
76-
"This is our first lab, and here we'll see that there is some data already provided for us. Next to the data, we will see a comment indicating what the data should look like after we change it. \n",
67+
"When storing text in a spreadsheet or database programmatically, you will often preprocess the data to ensure that it is properly formatted. For example, you might ensure that a telephone number matches the required format, or that a field on a web form is filled out. \n",
7768
"\n",
78-
"For example, let's say we want to capitalize all of the letters of \"art vandlay\". We'll see the following:"
69+
"Here's a simple example of how you might go about doing this:"
7970
]
8071
},
8172
{
@@ -86,21 +77,22 @@
8677
},
8778
"outputs": [],
8879
"source": [
89-
"\"art vandelay\" # \"ART VANDELAY\""
80+
"name = \"art vandelay\" # \"ART VANDELAY\"\n",
81+
"name.upper()"
9082
]
9183
},
9284
{
9385
"cell_type": "markdown",
9486
"metadata": {},
9587
"source": [
96-
"Notice that there is no output below the gray code above. This is because Jupyter notebooks do not automatically run our code - so they do not automatically know the output. To display the output, we must **run** the code by clicking on the gray cell and then pressing shift + enter. Let's try it in the cell above and see our output appear below."
88+
"If you haven't already, put your cursor into the cell above and press `shift + enter` to run the code in the cell. You should see an updated output produced by the `.upper()` string method. "
9789
]
9890
},
9991
{
10092
"cell_type": "markdown",
10193
"metadata": {},
10294
"source": [
103-
"Ok, once we see the output take a look at the cell below with the hash tag to the right of the string, `'hello'`. This is a comment like the above. Comments are used for programmers to annotate their code, but a comment has no impact on the code. We can see this by running the cell below (again, press shift + enter)."
95+
"Another important note is the hashtag `#`. In python, hashtags indicate a comment. Comments are notes used to provide additional information but are ignored by the computer when running the code. "
10496
]
10597
},
10698
{
@@ -118,46 +110,23 @@
118110
"cell_type": "markdown",
119111
"metadata": {},
120112
"source": [
121-
"After pressing shift+enter on the cell above, we see that still Python happily ignores our comment. So here (and in future labs), a comment will be provided to indicate what we should see as the return value of our code. When we press shift+enter, and the output below matches the comment to the right of our code, we did it correctly."
122-
]
123-
},
124-
{
125-
"cell_type": "markdown",
126-
"metadata": {},
127-
"source": [
128-
"> In future labs, Learn will check our code to ensure that we did it correctly. But for our first lab, this works fine."
129-
]
130-
},
131-
{
132-
"cell_type": "markdown",
133-
"metadata": {},
134-
"source": [
135-
"To get our output to match the comment we will change it to the following:"
136-
]
137-
},
138-
{
139-
"cell_type": "code",
140-
"execution_count": null,
141-
"metadata": {
142-
"collapsed": true
143-
},
144-
"outputs": [],
145-
"source": [
146-
"\"art vandelay\".upper() # 'ART VANDELAY'"
113+
"After pressing shift+enter on the cell above, you'll see that Python ignores the comment. In Flatiron coding labs, a comment will be provided to indicate what you are aiming to have the code return. This allows you to then easily check your answer upon running your code."
147114
]
148115
},
149116
{
150117
"cell_type": "markdown",
151118
"metadata": {},
152119
"source": [
153-
"### Get going with strings"
120+
"### Get going with strings\n",
121+
"\n",
122+
"With that, use the appropriate string method to transform each string to match the desired output in the comment."
154123
]
155124
},
156125
{
157126
"cell_type": "markdown",
158127
"metadata": {},
159128
"source": [
160-
"First use the `title` method to capitalize the first letter of each word in \"art vandelay\"`."
129+
"Use the `title` method to capitalize the first letter of each word in \"art vandelay\"`."
161130
]
162131
},
163132
{
@@ -175,7 +144,7 @@
175144
"cell_type": "markdown",
176145
"metadata": {},
177146
"source": [
178-
"Now let's uppercase all of the letters of \"Ceo\"."
147+
"Now use the `uppercase` method to capitalize all of the letters of \"Ceo\"."
179148
]
180149
},
181150
{
@@ -193,7 +162,7 @@
193162
"cell_type": "markdown",
194163
"metadata": {},
195164
"source": [
196-
"Next, write a method that answers a question about our email addresses. Every email address should end with \".com\". We can use our knowledge of string methods to check if the email address ends with \".com\" and return `True` or `False` accordingly. "
165+
"Next, write a method that verifies whether an email addresses is valid. To make this introductory example simple, assume that every email address should end with \".com\". With that, use your knowledge of string methods to check if the email address ends with \".com\" and return `True` or `False` accordingly. "
197166
]
198167
},
199168
{
@@ -211,7 +180,7 @@
211180
"cell_type": "markdown",
212181
"metadata": {},
213182
"source": [
214-
"As you can see below, the website \"vandelay.com\" is not preceded by `\"www.\"`. We can perform what is called string concatenation to fix this! Use the plus sign, `'+'`, to change the website `'vandelay.com'` to the string `'www.vandelay.com'` by prepending `'www.'`."
183+
"As you can see below, the website \"vandelay.com\" is not preceded by `\"www.\"`. You can perform string concatenation to fix this! string concatenation allows you to join two strings. It works just like numerical addition. For example, ```\"This is the start\" + \"and this is the end\"``` would return ```\"This is the start and this is the end\"```. Use string concatenation to change the website `'vandelay.com'` to the string `'www.vandelay.com'` by prepending `'www.'`."
215184
]
216185
},
217186
{
@@ -230,14 +199,14 @@
230199
"cell_type": "markdown",
231200
"metadata": {},
232201
"source": [
233-
"### Working with numbers"
202+
"### String Slicing"
234203
]
235204
},
236205
{
237206
"cell_type": "markdown",
238207
"metadata": {},
239208
"source": [
240-
"Finally, Mr. Vandelay gave us his phone number, but he actually has two other phone numbers that are different from the one listed. All three numbers are basically the same with the exception of the ending. Below, start by coercing the first phone number, which is currently a string, to an `int` and add one. Next do the same to the second phone number but increase it by two."
209+
"Finally, Mr. Vandelay gave us his phone number. Extract the area code by selecting the first three characters of the string. You can do this using brackets to select characters from the string as in ```\"George\"[:4]``` which would return ```\"Geor\"```."
241210
]
242211
},
243212
{
@@ -248,7 +217,7 @@
248217
},
249218
"outputs": [],
250219
"source": [
251-
"\"7285553334\" # 7285553335"
220+
"\"7285553334\" # 728"
252221
]
253222
},
254223
{
@@ -259,7 +228,7 @@
259228
},
260229
"outputs": [],
261230
"source": [
262-
"\"7285553334\" # 7285553336"
231+
"\"7285553334\" # 728"
263232
]
264233
},
265234
{
@@ -273,7 +242,7 @@
273242
"cell_type": "markdown",
274243
"metadata": {},
275244
"source": [
276-
"Our first lab is done! Sweet. In this lab, we practiced working with string methods to operate on and answer questions about strings. We wrote methods that return Booleans and changed strings to integers in order to perform addition. So much of working with data is ensuring that it is properly formatted so we can then operate on it, and in this lab, we saw how to use code to do just that."
245+
"Congratulations! You just completed your first lab! You practiced working with string methods to operate on and answer questions about strings. You also used methods that return Booleans and sliced strings. So much of working with data is ensuring that it is properly formatted and in this lab, you started practicing your data wrangling skills."
277246
]
278247
}
279248
],
@@ -293,7 +262,7 @@
293262
"name": "python",
294263
"nbconvert_exporter": "python",
295264
"pygments_lexer": "ipython3",
296-
"version": "3.6.4"
265+
"version": "3.6.5"
297266
}
298267
},
299268
"nbformat": 4,

0 commit comments

Comments
 (0)