Skip to content

Commit 883ee62

Browse files
authored
Merge pull request #170 from datacarpentry/annajiat-patch-2
Update 04-reusable.md
2 parents 3a3c02f + 775d1d8 commit 883ee62

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

_episodes/04-reusable.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,13 @@ print(get_item_count(items_str = items_owned, sep=';'))
109109
> > - A function to calculate the volume of a cuboid could be:
110110
> >
111111
> > ~~~
112-
> > def calculate_vol_cuboid(h, w, l):
112+
> > def calculate_vol_cuboid(h, w, len):
113113
> > """
114114
> > Calculates the volume of a cuboid.
115-
> > Takes in h, w, l, that represent height, width, and length of the cube.
115+
> > Takes in h, w, len, that represent height, width, and length of the cube.
116116
> > Returns the volume.
117117
> > """
118-
> > volume = h * w * l
118+
> > volume = h * w * len
119119
> > return volume
120120
> > ~~~
121121
> > {: .language-python}
@@ -125,15 +125,15 @@ print(get_item_count(items_str = items_owned, sep=';'))
125125
> >
126126
> > ~~~
127127
> > # Method 1 - single function
128-
> > def calculate_cuboid(h, w, l):
128+
> > def calculate_cuboid(h, w, len):
129129
> > """
130-
> > Calculates information about a cuboid defined by the dimensions h(eight), w(idth), and l(ength).
130+
> > Calculates information about a cuboid defined by the dimensions h(eight), w(idth), and len(gth).
131131
> >
132132
> > Returns the volume, surface area, and sum of edges of the cuboid.
133133
> > """
134-
> > volume = h * w * l
135-
> > surface_area = 2 * (h * w + h * l + l * w)
136-
> > edges = 4 * (h + w + l)
134+
> > volume = h * w * len
135+
> > surface_area = 2 * (h * w + h * len + len * w)
136+
> > edges = 4 * (h + w + len)
137137
> > return volume, surface_area, edges
138138
> > ~~~
139139
> > {: .language-python}
@@ -142,42 +142,42 @@ print(get_item_count(items_str = items_owned, sep=';'))
142142
> > calculating. Our functions would look like this:
143143
> > ~~~
144144
> > # Method 2 - separate functions
145-
> > def calc_volume_of_cuboid(h, w, l):
145+
> > def calc_volume_of_cuboid(h, w, len):
146146
> > """
147-
> > Calculates the volume of a cuboid defined by the dimensions h(eight), w(idth), and l(ength).
147+
> > Calculates the volume of a cuboid defined by the dimensions h(eight), w(idth), and len(gth).
148148
> > """
149-
> > volume = h * w * l
149+
> > volume = h * w * len
150150
> > return volume
151151
> >
152152
> >
153-
> > def calc_surface_area_of_cuboid(h, w, l):
153+
> > def calc_surface_area_of_cuboid(h, w, len):
154154
> > """
155-
> > Calculates the surface area of a cuboid defined by the dimensions h(eight), w(idth), and l(ength).
155+
> > Calculates the surface area of a cuboid defined by the dimensions h(eight), w(idth), and len(gth).
156156
> > """
157-
> > surface_area = 2 * (h * w + h * l + l * w)
157+
> > surface_area = 2 * (h * w + h * len + len * w)
158158
> > return surface_area
159159
> >
160160
> >
161-
> > def calc_sum_of_edges_of_cuboid(h, w, l):
161+
> > def calc_sum_of_edges_of_cuboid(h, w, len):
162162
> > """
163-
> > Calculates the sum of edges of a cuboid defined by the dimensions h(eight), w(idth), and l(ength).
163+
> > Calculates the sum of edges of a cuboid defined by the dimensions h(eight), w(idth), and len(gth).
164164
> > """
165-
> > sum_of_edges = 4 * (h + w + l)
165+
> > sum_of_edges = 4 * (h + w + len)
166166
> > return sum_of_edges
167167
> > ~~~
168168
> > {: .language-python}
169169
> >
170170
> > We could then rewrite our first solution:
171171
> > ~~~
172-
> > def calculate_cuboid(h, w, l):
172+
> > def calculate_cuboid(h, w, len):
173173
> > """
174-
> > Calculates information about a cuboid defined by the dimensions h(eight), w(idth), and l(ength).
174+
> > Calculates information about a cuboid defined by the dimensions h(eight), w(idth), and len(gth).
175175
> >
176176
> > Returns the volume, surface area, and sum of edges of the cuboid.
177177
> > """
178-
> > volume = calc_volume_of_cuboid(h, w, l)
179-
> > surface_area = calc_surface_area_of_cuboid(h, w, l)
180-
> > edges = calc_sum_of_edges_of_cuboid(h, w, l)
178+
> > volume = calc_volume_of_cuboid(h, w, len)
179+
> > surface_area = calc_surface_area_of_cuboid(h, w, len)
180+
> > edges = calc_sum_of_edges_of_cuboid(h, w, len)
181181
> >
182182
> > return volume, surface_area, edges
183183
> > ~~~

0 commit comments

Comments
 (0)