python的流控语句



1,while
   while True:
     print(‘do something’)
     .....
2,if  elif  else
  if x<10:
    print('a')
  elif x<100:
    print('b')
  else:
    print('c')
    
3,for
  for  i in range(0,10)
    print(i)
4,break
  while True:
    if n>100:
      break
    else:
      n=n+1
5,continue
  for i in range(0,1000):
    if i%3==0:
      continue
    else:
      print('x')
6,pass
  def f0():
    pass
    

猜你喜欢

转载自blog.csdn.net/weixin_44311188/article/details/85626321