用python写一个计算圆面积的脚本
以下是用Python编写计算圆面积的脚本:
import math
# 提示用户输入半径
radius = float(input("请输入圆的半径: "))
# 计算圆的面积
area = math.pi * radius ** 2
# 打印结果
print("圆的面积为:", round(area, 2))
运行结果:
请输入圆的半径: 5
圆的面积为: 78.54
原文地址: https://www.cveoy.top/t/topic/GaS 著作权归作者所有。请勿转载和采集!