为什么我会遇到UnboundLocalError?

2024-10-02 18:14:39 发布

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

我有一个代码如下

b=1
c=50
d=1
e=5
.
.
.
St= tritriangle(1,b,c,d,e)
.
.
.

在另一个.py file中,我有如下函数:

def tritriangle(Ashape,Bshape,Cshape,Dshape,Eshape)
    Cshape *= 1.0
    Fshape *= Cshape
    return Fshape

这里python给出了Cshape的UnboundLocalError。这有什么问题?你知道吗


Tags: 函数代码pyreturndeffilestunboundlocalerror