Discuss / Python / 作业

作业

Topic source

Herman.

#1 Created at ... [Delete] [Delete and Lock User]
PI = 3.14159265453r = float(input('请输入您所求圆的半径:'))

def area_of_circle(r):

    if r<0:

        return None
    else:
        return PI*r**2
s = area_of_circle(r)

print(f"所求半径为{r:.2f}的圆面积为{s:.2f}")

  • 1

Reply