【发布时间】:2020-01-17 06:27:56
【问题描述】:
当我运行代码时,我似乎无法让主函数显示区域函数。它显示半径函数。我让面积函数使用半径函数中的变量。
def radius(x, y, a, b):
d = math.sqrt((x - a)**2 + (y - b)**2)
print('The distance between the center points: ', d)
def area(d):
pi = math.pi
ar = pi * d**2
print('The area of the circle: ', ar)
def main():
print('Enter first coordinates:')
x = int(input('Enter X: '))
y = int(input('Enter Y: '))
print('Enter second coordinates: ')
a = int(input('Enter X: '))
b = int(input('Enter Y: '))
radius(x, y, a, b)
area(d)
main()
【问题讨论】:
-
将
return ar添加到radius,然后在main 中添加d = radius...