Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Python Program help

Name: Anonymous 2011-10-12 16:54

Can someone list all the syntax and semantic errors in the following program. It's in Python/Jython.

def flag(size):
  pic = makeEmptyPicture(size, size)
  for x in range(size):
    for y in rage(size):
    pix = getPixel(pic, x, y)
      #make the upper left black
      if y <= (.5 * size) and x <= (.5 * size)
        setColor(pix, black)
      #make the upper left black
      if y <= (.5 * size) and y <= (.5 * size):
        setColor(pix, orange)
  return pic

Name: Anonymous 2011-10-12 19:46

Line 5 missing 2 leading spaces.
Line 7 missing the trailing colon.

def fag(size):
  pic = makeEmptyPicture(size, size)
  for x in range(size):
    for y in rage(size):
      pix = getPixel(pic, x, y)
      #make the upper left black
      if y <= (.5 * size) and x <= (.5 * size):
        setColor(pix, black)
      #make the upper left black
      if y <= (.5 * size) and y <= (.5 * size):
        setColor(pix, orange)
  return pic

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List