|
11 | 11 | "cell_type": "markdown",
|
12 | 12 | "metadata": {},
|
13 | 13 | "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" |
15 | 15 | ]
|
16 | 16 | },
|
17 | 17 | {
|
18 | 18 | "cell_type": "markdown",
|
19 | 19 | "metadata": {},
|
20 | 20 | "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." |
22 | 24 | ]
|
23 | 25 | },
|
24 | 26 | {
|
25 | 27 | "cell_type": "markdown",
|
26 | 28 | "metadata": {},
|
27 | 29 | "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`." |
29 | 71 | ]
|
30 | 72 | },
|
31 | 73 | {
|
32 | 74 | "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", |
34 | 84 | "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 |
| - ], |
47 | 85 | "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" |
49 | 109 | ]
|
50 | 110 | },
|
51 | 111 | {
|
52 | 112 | "cell_type": "markdown",
|
53 | 113 | "metadata": {},
|
54 | 114 | "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`." |
56 | 116 | ]
|
57 | 117 | },
|
58 | 118 | {
|
|
63 | 123 | },
|
64 | 124 | "outputs": [],
|
65 | 125 | "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." |
67 | 148 | ]
|
68 | 149 | }
|
69 | 150 | ],
|
|
0 commit comments