import math
# 计算一个数的平方根
number = 16
square_root = math.sqrt(number)
print(f"数字 {number} 的平方根是 {square_root}")
import math:导入 Python 的 math 模块,该模块提供了许多数学函数和常量。math.sqrt(number):使用 math.sqrt() 函数计算给定数字 number 的平方根。print():输出结果,显示原始数字及其平方根。如果你需要计算其他数字的平方根,只需更改 number 的值即可。
上一篇:python 命令行
下一篇:python读取excel数据
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站