Commit 7f001a13 by BellCodeEditor

auto save

parent 87be3438
Showing with 35 additions and 0 deletions
1range(start=0,stop,step=1)
range(1,5,2)
1..4 , 1 3
for i in range(5):
print(i)
for i in range(1,5):
print(i)
for i in range(1,5,2):
print(i)
for i in xxx:
2,for循环可以遍历任何序列的项目
语法:for i in xxx:
遍历的对象要求是一个迭代对象(可以简单看作一个容器,里面包括很多个元素)
如:
goods=['可乐','咖啡','鸡翅','冰淇淋']
for i in goods:
print(i)
执行结果:
可乐
咖啡
鸡翅
冰淇淋
\ No newline at end of file
goods=['可乐','咖啡','鸡翅','冰淇淋']
for i in goods:
print(i)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment