2.12.2 for循环
# for 循环 for letter in 'Names': print(letter) ''' N a m e s ''' name_list=['walter','Nicole','d'] for name in name_list: print(name) ''' walter Nicole d '''
#遍历 0到4 for r in range(101): print(r) # 求101以内的和 sum=0 for i in range(101): sum=sum + i print(sum)
# 循环嵌套 boys =['Mike','Jack'] girl=['lily','Mary'] for i in boys: for j in girl: print('%s,kiss,%s'%(i,j))