我是python的初学者,在学习python的过程中,我在执行if
语句时出错
有人能告诉我代码中遗漏了什么吗
File "Demo_class2_Conditions.py", line 8
print(X)
^
IndentationError: expected an indented block
X=int(input('Enter the value of X:'))
Y=int(input('Enter the value of Y:'))
Z=int(input('Enter the value of Z:'))
if X > Y:
if X > Y:
print(X)
else:
print(Y)
else:
if Y > Z:
if Y > Z:
print(Y)
else:
print(Z)
在条件之后,应始终缩进属于块的语句(2或4个空格)
您的示例可以正确缩进,如下所示:
相关问题 更多 >
编程相关推荐