如何在Python中的循环中使用else语句?

else块在迭代之后且程序控制退出循环块之前执行

x=0
while x<5:
   x=x+1
   print (x)
else:
   print ("else block of loop")
print ("loop is over")