Python 为什么我在将2个必需的位置参数添加到函数时缺少它们?

Python 为什么我在将2个必需的位置参数添加到函数时缺少它们?,python,python-3.x,Python,Python 3.x,我曾尝试在函数中将变量更改为整数,但没有成功。我也不想让它成为一个全局函数 # Finds the max size of another angle in the triangle side1 = input("First side: ") side2 = input("Second side: ") side1 = int(side1) side2 = int(side2) def nextEdge(side1, side2): maxLength = (side1 + s

我曾尝试在函数中将变量更改为整数,但没有成功。我也不想让它成为一个全局函数

# Finds the max size of another angle in the triangle

side1 = input("First side:  ")
side2 = input("Second side:  ")

side1 = int(side1)
side2 = int(side2)

def nextEdge(side1, side2):
    maxLength = (side1 + side2)
    return maxLength

nextEdge()

print(maxLength)

您正在调用无任何参数的nextEdge。您对nextEdge的呼叫应如下所示:

maxLength = nextEdge(side1, side2)

此处缺少两个必需参数:
nextEdge()
。将它们添加到该函数调用中。