我是初学者,所以要友善
尝试更改此代码以包含while循环或修改它使用all while循环
谁能帮忙吗
def shrink():
picture = makePicture(pickAFile())
newPicture = makeEmptyPicture(getWidth(picture) /2, getHeight(picture) /2)
#time for our shrinking ray gun to work
while x in range(getWidth(picture)):
while y in range(getHeight(picture)):
originalPixel = getPixel(picture, x, y)
color = getColor(originalPixel)
newPixel = getPixel(newPicture, x / 2, y / 2)
setColor(newPixel, color)
show(picture)
#Show and tell
show(newPicture)
目前没有回答
相关问题 更多 >
编程相关推荐