We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents cf55509 + e7193a8 commit 7b1ee46Copy full SHA for 7b1ee46
1 file changed
content/functions/exercises/_index.md
@@ -274,10 +274,17 @@ You will find the starter code in `data-analysis-projects/functions/exercises/fu
274
```python {linenos=table}
275
def make_diamond(height):
276
diamond = ""
277
- triangle = make_isosceles_triangle(height)
278
- diamond += triangle[:-1]
279
- for i in range(len(triangle)-1, -1, -1):
280
- diamond += triangle[i]
+
+ for i in range(height):
+ spaces = " " * (height - i - 1)
+ hash = "#" * (2 * i + 1)
281
+ diamond += spaces + hash + "\n"
282
283
+ for i in range(height - 2, -1, -1):
284
285
286
287
288
return diamond
289
290
print(make_diamond(5))
0 commit comments