python 对math 库的使用:输入一个实数×,轮出其绝对值/x1、1*的平方根、exsin(x+I:4)、1og100x1、向上取格效、向下职整数、整效部分。 写出代码
```python
import math
x = float(input("请输入一个实数:"))
abs_x = abs(x)
sqrt_x = math.sqrt(abs_x)
exp_sin_x = math.exp(math.sin(x))
log10_x = math.log10(abs_x)
ceil_x = math.ceil(x)
floor_x = math.floor(x)
trunc_x = math.trunc(x)
print("绝对值:", abs_x)
print("平方根:", sqrt_x)
print("e^sin(x):", exp_sin_x)
print("log10(|x|):", log10_x)
print("向上取整:", ceil_x)
print("向下取整:", floor_x)
print("整数部分:", trunc_x)
```
import math
x = float(input("请输入一个实数:"))
abs_x = abs(x)
sqrt_x = math.sqrt(abs_x)
exp_sin_x = math.exp(math.sin(x))
log10_x = math.log10(abs_x)
ceil_x = math.ceil(x)
floor_x = math.floor(x)
trunc_x = math.trunc(x)
print("绝对值:", abs_x)
print("平方根:", sqrt_x)
print("e^sin(x):", exp_sin_x)
print("log10(|x|):", log10_x)
print("向上取整:", ceil_x)
print("向下取整:", floor_x)
print("整数部分:", trunc_x)
```
上一篇:对传统教育的看法