Lesson 7.1: ASCII Art Generators

Today’s Goals

  • Use loops and strings to create ASCII art
  • Practice printing patterns
  • Begin creative coding in Python

Warm-Up Question

  • What symbols or characters would you use to draw with text?

ASCII Art Basics

  • ASCII art uses characters to form images
  • Example characters: *, #, @, -

Simple Example

for i in range(5):
    print("*" * i)

Output:

*
**
***
****

Another Example

for i in range(5, 0, -1):
    print("#" * i)

Output:

#####
####
###
##
#

Class Practice

  • Try making a triangle with @
  • Try making a diamond shape with *

Student Challenge

  • Create an ASCII art generator that asks the user for:

    • A character
    • A height
  • Print a pyramid with those choices

Wrap-Up

  • ASCII art is a fun way to use loops and strings
  • Next time: We’ll create story randomizers