Python 3.x my Python代码中的错误:Python中的elseif错误
下面的代码不工作Python 3.x my Python代码中的错误:Python中的elseif错误,python-3.x,Python 3.x,下面的代码不工作 N = int(input()) print("Enter number",N) if(N%2!=0): print("Weird") elif (N%2==0) and (N>=2 and N<=5): print("Not Weird") elif(N%2==0) and (N>=6 and N<=20): print("Weird") else: print("
N = int(input())
print("Enter number",N)
if(N%2!=0):
print("Weird")
elif (N%2==0) and (N>=2 and N<=5):
print("Not Weird")
elif(N%2==0) and (N>=6 and N<=20):
print("Weird")
else:
print("Not Weird")
N=int(输入())
打印(“输入编号”,N)
如果(N%2!=0):
印刷品(“怪异”)
elif(N%2==0)和(N>=2,N=6,N=2,N问题在于缩进
N = int(input())
print("Enter number",N)
if(N%2!=0):
print("Weird")
elif (N%2==0) and (N>=2 and N<=5):
print("Not Weird")
elif(N%2==0) and (N>=6 and N<=20):
print("Weird")
else:
print("Not Weird")
N=int(输入())
打印(“输入编号”,N)
如果(N%2!=0):
印刷品(“怪异”)
elif(N%2==0)和(N>=2,N=6,N问题在于缩进
N = int(input())
print("Enter number",N)
if(N%2!=0):
print("Weird")
elif (N%2==0) and (N>=2 and N<=5):
print("Not Weird")
elif(N%2==0) and (N>=6 and N<=20):
print("Weird")
else:
print("Not Weird")
N=int(输入())
打印(“输入编号”,N)
如果(N%2!=0):
印刷品(“怪异”)
elif(N%2==0)和(N>=2和N=6和N根据缩进,如果没有if
,则不能启动elif
,应始终启动if
,然后启动elif
。您可以检查以下条件:
print("Enter number")
N = int(input())
if(N%2!=0):
print("Weird")
elif (N%2==0) and (N>=2 and N<=5):
print("Not Weird")
elif(N%2==0) and (N>=6 and N<=20):
print("Weird")
else:
print("Not Weird")
打印(“输入编号”)
N=int(输入())
如果(N%2!=0):
印刷品(“怪异”)
elif(N%2==0)和(N>=2和N=6和N根据缩进,如果没有if
,则不能启动elif
,应始终启动if
,然后启动elif
。您可以检查以下条件:
print("Enter number")
N = int(input())
if(N%2!=0):
print("Weird")
elif (N%2==0) and (N>=2 and N<=5):
print("Not Weird")
elif(N%2==0) and (N>=6 and N<=20):
print("Weird")
else:
print("Not Weird")
打印(“输入编号”)
N=int(输入())
如果(N%2!=0):
印刷品(“怪异”)
elif(N%2==0)和(N>=2和N=6,NPython对其语法要求非常严格,请确保您的if
-elif
-else
都从同一列开始。您的代码有缩进问题,请首先解决。Python对其语法要求非常严格,请确保您的if
-elif
-else
都从同一列开始n、 您的代码有缩进问题,请先解决。谢谢您dip bazz谢谢您dip bazz