Python - 27

Python - 27: Creating ASCII Art

ASCII art uses ordinary text characters to create simple pictures, patterns, and designs.

Your challenge: Explore how loops and repeated characters can build simple text patterns.

✦ Python Editor
▶ Output

Print a picture line by line

Each print() statement can create one line of an ASCII picture.

Spaces matter because they control where the characters appear.

Build patterns with loops

Nested loops can create rows and columns. The outer loop controls the rows, while the inner loop prints the characters in each row.

Repeat a character

Python can repeat a string with *.

For example: "*" * 4 creates ****.

Create a triangle

If row increases from 1 to 5, then "*" * row creates a wider line each time.

Try it: Replace * with @, +, or another character to create a different pattern.

Good Python habit: Keep starter code runnable, then experiment by changing one small part at a time.

👀 Show Example Solution
print("  _____")
print(" [ o o ]")
print(" [  ^  ]")
print(" [ --- ]")

print()

for row in range(4):

    for column in range(4):
        print("#", end=" ")

    print()

print()

for row in range(1, 6):
    print("*" * row)

print()

print("  +")
print(" +++")
print("+++++")

The starter now runs correctly before the learner edits anything. The square uses nested loops, while the triangle repeats a character based on the current row number.