Skip to content

Commit cf55509

Browse files
Merge pull request #159 from LaunchCodeEducation/call-center-cleanup-audit
Corrected a couple of functions exercises
2 parents f003abd + 44d1a3e commit cf55509

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

content/functions/exercises/_index.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,23 @@ You will find the starter code in `data-analysis-projects/functions/exercises/fu
9090
#####
9191
```
9292

93+
{{% expand "Check your solution" %}}
94+
95+
```python {linenos=table}
96+
def make_square(size):
97+
98+
square = ""
99+
for i in range(size):
100+
square += make_line(size)
101+
if i < size - 1:
102+
square += "\n"
103+
return square
104+
105+
print(make_square(5))
106+
```
107+
108+
{{% /expand %}}
109+
93110
{{% notice orange Warning %}}
94111

95112
For each of the shape exercises, do not include a newline character at
@@ -159,7 +176,9 @@ You will find the starter code in `data-analysis-projects/functions/exercises/fu
159176
def make_downward_stairs(height):
160177
stairs = ""
161178
for i in range(height):
162-
stairs += (make_line(i+1) + "\n")
179+
stairs += make_line(i+1)
180+
if i < height - 1:
181+
stairs += "\n"
163182
return stairs
164183

165184
print(make_downward_stairs(5))
@@ -216,7 +235,9 @@ You will find the starter code in `data-analysis-projects/functions/exercises/fu
216235
def make_isosceles_triangle(height):
217236
triangle = ""
218237
for i in range(height):
219-
triangle += (make_space_line(height - i - 1, 2 * i + 1) + "\n")
238+
triangle += make_space_line(height - i - 1, 2 * i + 1)
239+
if i < height - 1:
240+
triangle += "\n"
220241
return triangle
221242

222243
print(make_isosceles_triangle(5))

0 commit comments

Comments
 (0)