Python
How do I manipulate this code to give me an image that fades from black to red going from left to right, where left would be black and fade to red going right.
def main():
f = open("testImage.ppm","w")
f.write("P3 \n")
width=256
height=256
f.write("%d %d \n"%(width,height))
f.write("255 \n")
for i in range(width*height):
x=i%256
y=i/256
f.write("255, 0, 0 \n")
f.close()
main()