---
# System prepended metadata

title: Homework 7

---

# Homework 7
```python=+
# draw_pyramid function
def draw_pyramid(level, size): # n for level, w for width
  clearscreen()
  setup(size*(level+4),size*(level+4))
  T = Turtle()
  T.color('red')
  T.speed(10**level)
  T.width(1.5)
  for i in range(level):
    for j in range(level):
      if i+j < level:
        T.jumpto(size*j+(size/2)*i-(size*level / 2),size*i-(size*level / 2))
        for _ in range(4):
          T.forward(size)
          T.left(90)
      else:
        break
level, size = map(int,input("Enter the level and size: ").split())
draw_pyramid(level, size)
```
![](https://i.imgur.com/o4XqzoZ.png)

```python=+