Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/309.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需要一个缩进块_Python - Fatal编程技术网

python需要一个缩进块

python需要一个缩进块,python,Python,我不知道为什么在我尝试跑步时会出现这种情况。我试着修好,但不行。有什么错误吗 import math print(" Hello....\n This program will ask you to enter 3 numbers \n (a, b and c) that will be used in the quadratic formula to \n calculate the roots of an equation ") a=float(input("Enter a Value

我不知道为什么在我尝试跑步时会出现这种情况。我试着修好,但不行。有什么错误吗

import math

print(" Hello....\n This program will ask you to enter 3 numbers \n (a, b and c) that will be used in the quadratic formula to \n calculate the roots of an equation ")

a=float(input("Enter a Value for a: "))

while(a <= 0):

print(" Please enter a number that is larger than 0.") <br/>
a=float(input("Please enter a value for A: "))

b=float(input("Enter a Value for b: "))

while(b <= a): <br/>
print(" Please enter a value that is larger than A.") <br/>
b=float(input("Enter a value for B: "))

c=float(input("Enter a Value for C: "))


root1 = float(-b + math.sqrt(b * b - 4 * a * c)/(2 * a)) <br/>
root2 = float(-b - math.sqrt(b * b - 4 * a * c)/(2 * a))

print("Root 1 is " , root1)<br/>
print("Root 2 is " , root2)<br/>
input("prompt: ")

第一:在Python中,缩进是必须的。从语法上讲,嵌套代码缩进是一种特性,而不是在源代码中滥发“paranthesis”


第二:显然,您从某处复制粘贴的HTML代码。摆脱。

是的,您需要缩进希望位于while循环中的代码。另外,请不要在你的问题中添加一堆不相关的标记。还有,为什么你的Python代码中会有这些标记?您可能会发现这个问题的答案很有帮助:。无论使用何种语言,只有没有经验的程序员才能缩进代码。与Python的唯一区别在于它是强制性的,我没有粘贴html代码,这些代码用于在流上的堆栈中断行。