def show():
file = raw_input("What is the name of the image file? ")
picture = Image(file)
width, height = picture.size()
pix = picture.getPixels()
Run Code Online (Sandbox Code Playgroud)
我正在尝试编写代码来显示此图像,但此代码不提供图像.如何更改我的代码才能显示此图像?
def average(tup):
""" ugiufh """
total = ((int(tup[0]) + int(tup[1]) + int(tup[2]))/3,
(int(tup[0]) + int(tup[1]) + int(tup[2]))/3,
(int(tup[0]) + int(tup[1]) + int(tup[2]))/3)
return total
Run Code Online (Sandbox Code Playgroud)
我正在编写一个函数来平均一个元组中的三个元素,这意味着如果原始元组=(1,2,3)给我元组=(2,2,2)
我的问题是有没有办法压缩写的内容给我相同的答案?如果是的话,如何凝聚它?
谢谢
def midpoint(p1, p2):
"""
PRE: p1 and p2 are Point objects (from the graphics module)
POST: a new Point equidistant from and co-linear with p1 and p2
is computed and returned
Run Code Online (Sandbox Code Playgroud)
使用以下规范编写函数中点