for循环
for i in range(1,4):
print("loop:",i)
输出100以内的奇数:
for i in range(1,101):
if i % 2 == 1:
print("loop:",i)
或者代码:
for i in range(1,101,2): #步长
print("loop:",i)
for循环
for i in range(1,4):
print("loop:",i)
输出100以内的奇数:
for i in range(1,101):
if i % 2 == 1:
print("loop:",i)
或者代码:
for i in range(1,101,2): #步长
print("loop:",i)