for循环
for i in range(1,10): print("loop",i) for i in range(1,100,2): #步长为2 print("loop",i); for i in range(1,100,2): print(i) if i==49: break elif i==41: continue
输出结果
H:\Python全栈\venv\Scripts\python.exe H:/Python全栈/Day05/for循环.py loop 1 loop 2 loop 3 loop 4 loop 5 loop 6 loop 7 loop 8 loop 9 loop 1 loop 3 loop 5 loop 7 loop 9 loop 11 loop 13 loop 15 loop 17 loop 19 loop 21 loop 23 loop 25 loop 27 loop 29 loop 31 loop 33 loop 35 loop 37 loop 39 loop 41 loop 43 loop 45 loop 47 loop 49 loop 51 loop 53 loop 55 loop 57 loop 59 loop 61 loop 63 loop 65 loop 67 loop 69 loop 71 loop 73 loop 75 loop 77 loop 79 loop 81 loop 83 loop 85 loop 87 loop 89 loop 91 loop 93 loop 95 loop 97 loop 99 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 Process finished with exit code 0
4556