🐍 PyQuest🔁 Loops Loops Loops · Pyramid Builder
0 XP🐍 Python is waking up…

Pyramid Builder ⭐

Remember how * repeats a string? "ha" * 4 gives hahahaha.

Now put that inside a loop where the number changes every turn, and something very satisfying happens:

for i in range(1, 5):
    print("⭐" * i)
⭐
⭐⭐
⭐⭐⭐
⭐⭐⭐⭐

A pyramid! Each turn, i is bigger, so the row is longer. You wrote two lines and got a shape.

This works with any character — #, 🍕, ~, whatever you like.

Your mission

  1. Make a variable block holding one emoji or symbol
  2. Use a loop with range(1, 8) so it runs 7 times
  3. Use * to print block repeated i times, so row 1 has one block and row 7 has seven

Your code

Press ▶ Run to see what your code does!