Skip to content

Commit 3fb6fd3

Browse files
committed
update variables lab to have assignment and reassignment
1 parent 01457bf commit 3fb6fd3

File tree

1 file changed

+100
-19
lines changed

1 file changed

+100
-19
lines changed

index.ipynb

Lines changed: 100 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,48 +11,108 @@
1111
"cell_type": "markdown",
1212
"metadata": {},
1313
"source": [
14-
"Now that you know about variables, you went from just attending Python conferences, to being a top knotch guest speaker. You want to send thank you notes to all of the attendees, and to do so efficiently."
14+
"### Introduction"
1515
]
1616
},
1717
{
1818
"cell_type": "markdown",
1919
"metadata": {},
2020
"source": [
21-
"### Labs with Learn"
21+
"Now that you know about variables, you want to use them to associate them with some data. Here, we will be using variables to store information related to a vacation that we would like to go on.\n",
22+
"\n",
23+
"Just as before, we ask you to run the code and ensure that it matches what is commented out."
2224
]
2325
},
2426
{
2527
"cell_type": "markdown",
2628
"metadata": {},
2729
"source": [
28-
"In the first lab, we ensured that we were doing things correctly by seeing that our output matched what we saw as a comment."
30+
"### Learning Objectives"
31+
]
32+
},
33+
{
34+
"cell_type": "markdown",
35+
"metadata": {},
36+
"source": [
37+
"* Practice variable assignment in Python\n",
38+
"* Practice variable reassignment in Python"
39+
]
40+
},
41+
{
42+
"cell_type": "markdown",
43+
"metadata": {},
44+
"source": [
45+
"### Assigning variables"
46+
]
47+
},
48+
{
49+
"cell_type": "markdown",
50+
"metadata": {},
51+
"source": [
52+
"Assign a variable of `travel_month` equal to the string \"January\", as that is the month you would like to travel."
53+
]
54+
},
55+
{
56+
"cell_type": "code",
57+
"execution_count": 7,
58+
"metadata": {
59+
"collapsed": true
60+
},
61+
"outputs": [],
62+
"source": [
63+
"travel_month = None"
64+
]
65+
},
66+
{
67+
"cell_type": "markdown",
68+
"metadata": {},
69+
"source": [
70+
"> We start by setting the variable equal to the data type None. As you know, `None` represents the absence of a value. And now you can take care of assigning the variable to something other than `None`."
2971
]
3072
},
3173
{
3274
"cell_type": "code",
33-
"execution_count": 4,
75+
"execution_count": 8,
76+
"metadata": {},
77+
"outputs": [],
78+
"source": [
79+
"travel_month # \"January\""
80+
]
81+
},
82+
{
83+
"cell_type": "markdown",
3484
"metadata": {},
35-
"outputs": [
36-
{
37-
"data": {
38-
"text/plain": [
39-
"'Art Vandelay'"
40-
]
41-
},
42-
"execution_count": 4,
43-
"metadata": {},
44-
"output_type": "execute_result"
45-
}
46-
],
4785
"source": [
48-
"'art vandelay'.title() # 'Art Vandelay'"
86+
"Now let's assign a variable equal to the number of weeks that you would like to travel, 3. "
87+
]
88+
},
89+
{
90+
"cell_type": "code",
91+
"execution_count": 9,
92+
"metadata": {
93+
"collapsed": true
94+
},
95+
"outputs": [],
96+
"source": [
97+
"number_of_weeks = None"
98+
]
99+
},
100+
{
101+
"cell_type": "code",
102+
"execution_count": 10,
103+
"metadata": {
104+
"collapsed": true
105+
},
106+
"outputs": [],
107+
"source": [
108+
"number_of_weeks # 3"
49109
]
50110
},
51111
{
52112
"cell_type": "markdown",
53113
"metadata": {},
54114
"source": [
55-
"In this lab, we will use double check if we are doing things correctly with Learn."
115+
"Now, you just learned that you can travel for a longer period of time. So reassign the `number_of_weeks` variable equal to `5`."
56116
]
57117
},
58118
{
@@ -63,7 +123,28 @@
63123
},
64124
"outputs": [],
65125
"source": [
66-
"name = 'art vandelay'"
126+
"number_of_weeks # 5"
127+
]
128+
},
129+
{
130+
"cell_type": "markdown",
131+
"metadata": {},
132+
"source": [
133+
"Now that's more like it."
134+
]
135+
},
136+
{
137+
"cell_type": "markdown",
138+
"metadata": {},
139+
"source": [
140+
"### Summary"
141+
]
142+
},
143+
{
144+
"cell_type": "markdown",
145+
"metadata": {},
146+
"source": [
147+
"Great! In this lab, you were able to get a sense how to store information in variables through assignment and reassignment."
67148
]
68149
}
69150
],

0 commit comments

Comments
 (0)