1. 程式人生 > >增for語句內容

增for語句內容

man print blog post bigger ger -- 一個 ==

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
")

增for語句內容