用python写输入a,b,c并利用a,b,c,表达出x=-b+根号下b平方-4ac/2a
时间: 2023-05-18 16:06:29 浏览: 194
以下是用 Python 代码表达出 x = (-b + sqrt(b**2 - 4*a*c)) / (2*a) 的方法:
```python
import math
a = float(input("请输入 a:"))
b = float(input("请输入 b:"))
c = float(input("请输入 c:"))
x = (-b + math.sqrt(b**2 - 4*a*c)) / (2*a)
print("x 的值为:", x)
```
其中,`math.sqrt()` 函数用于计算平方根,`**` 表示乘方运算。
阅读全文
相关推荐
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![docx](https://img-home.csdnimg.cn/images/20241231044901.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![docx](https://img-home.csdnimg.cn/images/20241231044901.png)