#make a yellow square inside a red one #the first parameter gives the length of the side of the red square #the second gives the length of the side of the yellow square #the returned value is the picture def yellow_in_red(rsize,ysize): p=makeEmptyPicture(rsize,rsize) for px in getPixels(p): setColor(px,red) for x in range(rsize/2-ysize/2,rsize/2+ysize/2): for y in range(rsize/2-ysize/2,rsize/2+ysize/2): px=getPixel(p,x,y) setColor(px,yellow) return p def yellowred(): redsize=input("Enter size of red square") yellowsize=input("Enter size of yellow square") show(yellow_in_red(redsize,yellowsize))