增for语句内容

1 #author:leon
2 #"hello world!"
3 
4  for   i  in  range(10):  #循环十次,每一次循环赋一个0-9中的数字给i 。
5      print("-------",i)

 

 

1 for   i  in  range(2,8,2):  #循环八次,从2-8,间隔(步幅)为2 。
2     print("-------",i)
 1 age_of_oldboy = 56
 2 count =0
 3 for  i in range(3):
 4     guess_age = int(input("guess age:"))
 5     if guess_age == age_of_oldboy:
 6         print("yes,you got  it...")
 7         break
 8     elif  guess_age > age_of_oldboy:
 9         print("think smaller...")
10     else:
11         print("think bigger....")
12     count +=1
13     if  count ==3:
14         print("you try  too many  times")

 

posted @ 2018-02-03 16:43  leon-zyl  阅读(124)  评论(0编辑  收藏  举报