1. 程式人生 > >流程控制之for循環

流程控制之for循環

控制 [1] range summer += int ron sum hello

for循環主要用於循環取值

student=【‘summer‘,‘dream‘,‘cold‘】

i=0

while i <len(students):

print (student[1])

i+=1

for item in student:

print(item)

for item in ‘hello‘

print(item)

dic={‘x‘,‘444‘,‘y‘,‘333‘,‘z‘,‘555‘}

for k in dic:

print(k,dic[k])

for i in range(1,10,3):

print(i)

for i in range(10):

print(i)

student=[‘summer‘,‘dream‘,‘cold‘]

for item in student:

print(item)

for i in range(len(student)):

print(i,student[i])

流程控制之for循環