@@ -109,13 +109,13 @@ print(get_item_count(items_str = items_owned, sep=';'))
109
109
> > - A function to calculate the volume of a cuboid could be:
110
110
> >
111
111
> > ~~~
112
- > > def calculate_vol_cuboid(h, w, l ):
112
+ > > def calculate_vol_cuboid(h, w, len ):
113
113
> > """
114
114
> > 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.
116
116
> > Returns the volume.
117
117
> > """
118
- > > volume = h * w * l
118
+ > > volume = h * w * len
119
119
> > return volume
120
120
> > ~~~
121
121
> > {: .language-python}
@@ -125,15 +125,15 @@ print(get_item_count(items_str = items_owned, sep=';'))
125
125
> >
126
126
> > ~~~
127
127
> > # Method 1 - single function
128
- > > def calculate_cuboid(h, w, l ):
128
+ > > def calculate_cuboid(h, w, len ):
129
129
> > """
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 ).
131
131
> >
132
132
> > Returns the volume, surface area, and sum of edges of the cuboid.
133
133
> > """
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 )
137
137
> > return volume, surface_area, edges
138
138
> > ~~~
139
139
> > {: .language-python}
@@ -142,42 +142,42 @@ print(get_item_count(items_str = items_owned, sep=';'))
142
142
> > calculating. Our functions would look like this:
143
143
> > ~~~
144
144
> > # Method 2 - separate functions
145
- > > def calc_volume_of_cuboid(h, w, l ):
145
+ > > def calc_volume_of_cuboid(h, w, len ):
146
146
> > """
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 ).
148
148
> > """
149
- > > volume = h * w * l
149
+ > > volume = h * w * len
150
150
> > return volume
151
151
> >
152
152
> >
153
- > > def calc_surface_area_of_cuboid(h, w, l ):
153
+ > > def calc_surface_area_of_cuboid(h, w, len ):
154
154
> > """
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 ).
156
156
> > """
157
- > > surface_area = 2 * (h * w + h * l + l * w)
157
+ > > surface_area = 2 * (h * w + h * len + len * w)
158
158
> > return surface_area
159
159
> >
160
160
> >
161
- > > def calc_sum_of_edges_of_cuboid(h, w, l ):
161
+ > > def calc_sum_of_edges_of_cuboid(h, w, len ):
162
162
> > """
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 ).
164
164
> > """
165
- > > sum_of_edges = 4 * (h + w + l )
165
+ > > sum_of_edges = 4 * (h + w + len )
166
166
> > return sum_of_edges
167
167
> > ~~~
168
168
> > {: .language-python}
169
169
> >
170
170
> > We could then rewrite our first solution:
171
171
> > ~~~
172
- > > def calculate_cuboid(h, w, l ):
172
+ > > def calculate_cuboid(h, w, len ):
173
173
> > """
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 ).
175
175
> >
176
176
> > Returns the volume, surface area, and sum of edges of the cuboid.
177
177
> > """
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 )
181
181
> >
182
182
> > return volume, surface_area, edges
183
183
> > ~~~
0 commit comments