Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 类型复杂vs int a=int(输入(“请输入a:”)的值) b=int(输入(“请输入b:”)的值) c=int(输入(“请输入c:”)的值) 根_1=(-b+((b**2)-4*a*c)**0.5)/2*a 根_2=(-b-((b**2)-4*a*c)**0.5)/2*a 如果根_10: root=“两个实根” elif root_1==0或root_2==0: root=“一个实根” 打印(“您输入的值有”,根)_Python_Types_Int - Fatal编程技术网

Python 类型复杂vs int a=int(输入(“请输入a:”)的值) b=int(输入(“请输入b:”)的值) c=int(输入(“请输入c:”)的值) 根_1=(-b+((b**2)-4*a*c)**0.5)/2*a 根_2=(-b-((b**2)-4*a*c)**0.5)/2*a 如果根_10: root=“两个实根” elif root_1==0或root_2==0: root=“一个实根” 打印(“您输入的值有”,根)

Python 类型复杂vs int a=int(输入(“请输入a:”)的值) b=int(输入(“请输入b:”)的值) c=int(输入(“请输入c:”)的值) 根_1=(-b+((b**2)-4*a*c)**0.5)/2*a 根_2=(-b-((b**2)-4*a*c)**0.5)/2*a 如果根_10: root=“两个实根” elif root_1==0或root_2==0: root=“一个实根” 打印(“您输入的值有”,根),python,types,int,Python,Types,Int,嗨,我有复杂的问题,int给了我一个错误。有解决办法吗?提前感谢。空穴问题在于您正在实施的逻辑中,以确定方程式的结果 您假设这是一个术语,用于区分以下内容中的词根: 根目录1和根目录2 但这正是关于真正根与否的信息: a = int(input("Please enter the value of a: ")) b = int(input("Please enter the value of b: ")) c = int(input("Please enter the value of c: "

嗨,我有复杂的问题,int给了我一个错误。有解决办法吗?提前感谢。

空穴问题在于您正在实施的逻辑中,以确定方程式的结果

您假设这是一个术语,用于区分以下内容中的词根: 根目录1根目录2

但这正是关于真正根与否的信息:

a = int(input("Please enter the value of a: "))
b = int(input("Please enter the value of b: "))
c = int(input("Please enter the value of c: "))

root_1 = (-b + ((b**2) - 4*a*c)**0.5) / 2*a
root_2 = (-b - ((b**2) - 4*a*c)**0.5) / 2*a

if root_1 < 0 or root_2 < 0:
   root = "No real roots"
elif root_1  > 0 or root_2 > 0:
   root = "Two real roots"
elif root_1 == 0 or root_2 == 0:
   root = "One real root"
print("The values you entered have", root)
这就是所谓的歧视

并计算为

如果此
(b**2)-4*a*c)
为正,则平方根为实数,但如果表达式为负,则平方根将产生一个虚数


您有什么问题?您在哪里使用
复合体
?错误是什么?TypeError:unorderable类型:complex()b^2-4*a*c是否大于0,而不是根。好的,谢谢我要试一试。(我应该知道)
(b**2) - 4*a*c)