โ† Back to Python Course
๐Ÿ”„ Loops & Repetitionยท25 minยทBeginner๐Ÿ† Project
๐ŸŽจ

Mini-Project: ASCII Art Generator

Draw pictures with text!

Use loops and strings to draw pictures made entirely of text characters. Create patterns, shapes, and art!

๐Ÿ“–

What we are learning

ASCII art is art made from text characters. Before we had emojis and color screens, people drew pictures using letters, numbers, and symbols. You will use loops to generate patterns and shapes from text!

๐Ÿ’ก Think of it like this:

Think of ASCII art like pixel art, but instead of colored pixels, you use characters like #, *, @, and spaces. Each character is like a tiny tile in a mosaic.

๐ŸŒŸ

Why it matters

This project shows how loops and string multiplication can create visual output. It is a fun way to see the power of repetition and patterns in code.

Where you see this in real life:

  • โœ“Text-based games use ASCII art for characters and scenery
  • โœ“Terminal and command-line tools use ASCII art for logos
  • โœ“Early computer graphics were entirely ASCII-based
๐ŸŽฏ

By the end, you can:

  • 1.Use nested for loops to create 2D patterns
  • 2.Combine string multiplication with loops
  • 3.Build a customizable art generator
๐Ÿ”ค

New words

nested loopstring multiplicationpatternASCII
๐Ÿ
Try to draw a smiley face using only keyboard characters. What symbols would you use for the eyes and mouth?
๐Ÿค“

Fun Fact!

ASCII art has been around since the 1960s! Some people can make incredibly detailed portraits using just text characters.

๐ŸŽจ ASCII Art Generator

ASCII art is art made from text characters! Before we had emojis and color screens, people drew pictures using letters, numbers, and symbols. You will use loops to create patterns and shapes!

๐Ÿ—๏ธ Step 1: Simple Patterns

Let us start with a simple pattern โ€” a line of stars!

๐ŸStep 1: A line of stars
main.py
โ— Output
end='' keeps everything on the same line!

๐Ÿ’ก end=""tells print() not to start a new line after each star.

๐Ÿ—๏ธ Step 2: A Triangle

Now let us make a triangle! Each row has more stars than the one before.

๐ŸStep 2: Star triangle!
main.py
โ— Output
Click โ–ถ Run to see the output!

๐Ÿ—๏ธ Step 3: A Box

To make a box, we use nested loops โ€” a loop inside a loop! The outer loop handles rows, the inner loop handles columns.

๐ŸStep 3: A box with nested loops!
main.py
โ— Output
Click โ–ถ Run to see the output!

๐Ÿ—๏ธ Step 4: A Diamond!

Now for something cool โ€” a diamond shape! We combine spaces and stars.

๐ŸStep 4: A diamond!
main.py
โ— Output
Click โ–ถ Run to see the output!

๐Ÿš€ Challenge: Make Your Own Art!

Try creating your own patterns! Here are some ideas:

  • ๐ŸŒŸ A pyramid made of # symbols
  • ๐ŸŒŸ A checkerboard pattern with # and spaces
  • ๐ŸŒŸ An upside-down triangle
  • ๐ŸŒŸ A hollow box (only borders filled)
๐ŸYour turn โ€” create art!
main.py
โ— Output
Click โ–ถ Run to see the output!
๐Ÿ
Amazing! You just made art with code! ๐ŸŽจ You used loops, string multiplication, and even nested loops!
๐Ÿง 

Quick Quiz!

+15 XP

What does the end='' parameter do in print()?

๐Ÿ
Finished the lesson? Click the button to mark it complete and earn XP!