# -*- coding:utf-8 -*- # -Author: Paulliam - for i in range (10): print("loop",i) print("------------------------") for i in range (0,10,3): #只打印0到9这10个数中能被3整除的数 print("loop",i)
######运行结果:
"D:\Program Files\python-3.6.4\python.exe" C:/Users/Administrator/Desktop/python-prj/while1-for.py
loop 0
loop 1
loop 2
loop 3
loop 4
loop 5
loop 6
loop 7
loop 8
loop 9
------------------------
loop 0
loop 3
loop 6
loop 9
Process finished with exit code 0