Ryuk
Well-known member
Heya, I'm having an exam in Informatics on Monday, we're c urrently working on the basic level Python programming.
I attached the code of a program that is supposed to make an image, takes the coordinates and the color and shows you a painted the image. The idea is to make the french flag.
There is something wrong with the code and I need your help so to make it more interesting the first person to propose me a working code will receive a reward (my total respect).
Here's what I came up with:
from PIL.Image import *
img = new("RGB", (1000,600))
def remplir(img, x1,x2,y1,y2,c):
for x in range(x1,x2):
for y in range(y1,y2):
Image.putpixel(img,x,y,c)
remplir(img,0,300,0,200,(100,200,0))
remplir(img,300,600,200,300,(200,100,0))
Happy resolving!
I attached the code of a program that is supposed to make an image, takes the coordinates and the color and shows you a painted the image. The idea is to make the french flag.
There is something wrong with the code and I need your help so to make it more interesting the first person to propose me a working code will receive a reward (my total respect).
Here's what I came up with:
from PIL.Image import *
img = new("RGB", (1000,600))
def remplir(img, x1,x2,y1,y2,c):
for x in range(x1,x2):
for y in range(y1,y2):
Image.putpixel(img,x,y,c)
remplir(img,0,300,0,200,(100,200,0))
remplir(img,300,600,200,300,(200,100,0))
Happy resolving!