# Work hard and try agin. Done is better than perfect.
# 进行for 循环的学习
for i in range(1,4):
print(‘i=‘,i) # 步长默认1,取1不取4
print(‘------------‘)
s=0
for i in range(1,5,2):
s = s+1
print(‘i=‘,i) # 步上默认2,取1不取5
print(‘s=‘,s)
print(‘------------‘)
for i in range(5,1,-1):
print("i=",i) # 取5不取1
执行结果:
原文:https://www.cnblogs.com/zx1313/p/14726048.html