Python experts: h e l p?

  import media



def intensity (p):

'''Return the int intensity of the Pixel p.

'''

r=media.get_red (p)

g=media.get_green (p)

b=media.get_blue (p)



return (r + g + b)/3.0





def grayscale (pic):

'''Return a new Picture that is a grayscale version of pic.

'''

new_pic=media.copy (pic)

for p in new_pic:

intensity=intensity (p)

media.set_red (p, intensity)

media.set_green (p, intensity)

media.set_blue (p, intensity)



return new_pic





def avg_intensity (pic):

'''Return the average intensity of the Picture pic.

'''



total=o

n=0

for p in pic:

intensity=intensity (p)

total +=intensity

n +=1



return total/n pets question and answers,www.5d2d.com





def normalize_color (p, factor):

'''Normalize the color of Pixel p by the given factor.

That is, multiply each colour component by factor - but don't let any

of them exceed 255.

'''



new_r=media.get_red (p) * factor

new_g=media.get_green (p) * factor

new_b=media.get_blue (p) * factor



new_r=255 if new_r> 255

new_g=255 if new_g> 255

new_b=255 if new_b> 255



media.set_red (p, new_r)

media.set_green (p, new_g)

media.set_blue (p, new_b)



def normalize (pic):

'''Return a new Picture that is a normalized version of pic.

'''



new_pic=media.copy (pic)



for p in new_pic:

norm=normalize_color (p, factor)

media.set_red (p, norm)

media.set_green (p, norm)



return new_pic pets question and answers,www.5d2d.com



if __name__=="__main__":

test_pic=media.load_picture (media.choose_file ())

test_color=media.springgreen



The very last function says an error "invalid red value'', I tried switching em around and finally made it work however the result is so similar with the orignal pic. I'm not sure what I'm missing at this point. Help would be appreciated!
gsfgsadfhdhdfhzdfhdhdzghghgjgfjsfgjdghjf ...

hzdfhfghghgjgnfngfhfgnbdghghshsdfhdghf ...

fbdhdfghghjfgjfjfghjfhfhkjgkjfhhdfhdhf ...

fdhzdfhdzfhdhdgjfjjfjx

ukcghk

gkgvk

k
what the hell are you talking about !!!!!!!
you're going to want to post this in the computer help section ... no one in reptiles (most likely) knows Python code: -)