Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/276.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_Python 3.6 - Fatal编程技术网

Python 未登录不匹配任何外部缩进级别-学校作业

Python 未登录不匹配任何外部缩进级别-学校作业,python,python-3.6,Python,Python 3.6,所以,基本上,我被我的代码卡住了,这是为了家庭作业,我不知道如何修复我遇到的错误 “未缩进与任何外部缩进级别不匹配” 我自己也尝试过修复它,但没有成功,所以我会向任何愿意帮助我的人伸出援手 这是我的密码 exit = False while not exit: #variables name=str(input("Enter your students name ")) #User ratings for rolleston spirit DSR=int(input("Ente

所以,基本上,我被我的代码卡住了,这是为了家庭作业,我不知道如何修复我遇到的错误 “未缩进与任何外部缩进级别不匹配” 我自己也尝试过修复它,但没有成功,所以我会向任何愿意帮助我的人伸出援手

这是我的密码

exit = False
while not exit:
  #variables
  name=str(input("Enter your students name "))

  #User ratings for rolleston spirit
  DSR=int(input("Enter rating for Develop Self "))
  BCR=int(input("Enter rating for Building Communities "))
  TFR=int(input("Enter rating for Transforming Futures "))    

  #If the input is above a certain number, it will print the student is doing well and if an input is below a ceratin number it will print the student needs support in .....
  if DSR>=6:
    print (name, "is doing well in developing self")
  elif DSR<4:
    print (name," needs support in developing self")
  if BCR>=6:
    print (name, "is doing well in Building Communities")
  elif BCR<4:
    print (name," needs support in Building Communities")
  if TFR>=6:
    print (name, "is doing well in Transforming Futures")
  elif TFR<4:
    print (name," needs support in Transforming Futures")

  #Function to find the highest number in a list
  def maxi(items):
  #max finds the highest number in a list
   return max(items)
  print(name, "highest score was ", maxi([DSR, BCR, TFR]))

#function to get average of a list 
  def Average(lst): 
      return sum(lst) / len(lst) 
# Creating List 
  lst = [DSR, BCR, TFR] 
  average = Average(lst) 
# Printing average of the list 
  print(name, "has an overall rating of ", round(average, 2))
  rep=str(input("Do you wish to continue? Y/N "))

 if rep=="Y":
   print ("  ")
 elif rep =="N":
   exit = True
print("  ")


代码中可能有空格与制表符混合,需要4个空格来缩进。试试这个:

exit = False
while not exit:
    #variables
    name=str(input("Enter your students name "))

    #User ratings for rolleston spirit
    DSR=int(input("Enter rating for Develop Self "))
    BCR=int(input("Enter rating for Building Communities "))
    TFR=int(input("Enter rating for Transforming Futures "))    

    #If the input is above a certain number, it will print the student is doing well and if an input is below a ceratin number it will print the student needs support in .....
    if DSR>=6:
        print (name, "is doing well in developing self")
    elif DSR<4:
        print (name," needs support in developing self")
    if BCR>=6:
        print (name, "is doing well in Building Communities")
    elif BCR<4:
        print (name," needs support in Building Communities")
    if TFR>=6:
        print (name, "is doing well in Transforming Futures")
    elif TFR<4:
        print (name," needs support in Transforming Futures")

#Function to find the highest number in a list
def maxi(items):
    #max finds the highest number in a list
    return max(items)
print(name, "highest score was ", maxi([DSR, BCR, TFR]))

#function to get average of a list 
def Average(lst): 
    return sum(lst) / len(lst) 
# Creating List 
lst = [DSR, BCR, TFR] 
average = Average(lst) 
# Printing average of the list 
print(name, "has an overall rating of ", round(average, 2))
rep=str(input("Do you wish to continue? Y/N "))

if rep=="Y":
    print ("  ")
elif rep =="N":
    exit = True
print("  ")
exit=False
不退出时:
#变数
name=str(输入(“输入学生姓名”))
#rolleston spirit的用户评级
DSR=int(输入(“为开发自我输入评级”))
BCR=int(输入(“输入建筑社区的评级”))
TFR=int(输入(“输入转换期货的评级”))
#如果输入高于某个数字,它将打印学生表现良好,如果输入低于ceratin数字,它将打印学生需要支持的内容。。。。。
如果DSR>=6:
印刷品(名称,“在自我发展方面做得很好”)
elif DSR=6:
打印(名称:“在社区建设中做得很好”)
elif BCR=6:
印刷品(名称,“在改造未来方面做得很好”)

elif Tfry您的缩进混乱-使用代码编辑器为您进行智能缩进。欢迎使用StackOverflow。显示错误消息的完整回溯——这将显示问题的根源(或接近问题的原因)。正如大家所说,你的缩进是错误的,试着用4个空格作为缩进,使用代码编辑器对你也会有很大的帮助。另外,我不知道作业,但是当你检查数字时,你对
5
什么也不做。也许这是应该发生的,但我只是想让你知道。帮助我认识到我做错了什么,感谢你的帮助:)
exit = False
while not exit:
    #variables
    name=str(input("Enter your students name "))

    #User ratings for rolleston spirit
    DSR=int(input("Enter rating for Develop Self "))
    BCR=int(input("Enter rating for Building Communities "))
    TFR=int(input("Enter rating for Transforming Futures "))    

    #If the input is above a certain number, it will print the student is doing well and if an input is below a ceratin number it will print the student needs support in .....
    if DSR>=6:
        print (name, "is doing well in developing self")
    elif DSR<4:
        print (name," needs support in developing self")
    if BCR>=6:
        print (name, "is doing well in Building Communities")
    elif BCR<4:
        print (name," needs support in Building Communities")
    if TFR>=6:
        print (name, "is doing well in Transforming Futures")
    elif TFR<4:
        print (name," needs support in Transforming Futures")

#Function to find the highest number in a list
def maxi(items):
    #max finds the highest number in a list
    return max(items)
print(name, "highest score was ", maxi([DSR, BCR, TFR]))

#function to get average of a list 
def Average(lst): 
    return sum(lst) / len(lst) 
# Creating List 
lst = [DSR, BCR, TFR] 
average = Average(lst) 
# Printing average of the list 
print(name, "has an overall rating of ", round(average, 2))
rep=str(input("Do you wish to continue? Y/N "))

if rep=="Y":
    print ("  ")
elif rep =="N":
    exit = True
print("  ")