类型错误:Float对象在我的代码中不可编辑

2024-04-25 02:08:25 发布

您现在位置:Python中文网/ 问答频道 /正文

我的代码中有两个独立的函数。一个是def main,一个是def calculations。以下是我的def计算代码:

def calculations(p1x, p1y, p2x, p2y):
    length = p2y - p1y
    width = p2x - p1x
    area = length * width
    perim = 2 * length + width
    return area
    return perim

当我稍后在这里试着调用它时:

^{pr2}$

我知道错误了

TypeError: 'float' object is not iterable.


Tags: 函数代码returnmaindefareawidthlength