Python学习笔记-循环语句
While 循环语句
flag=False name = raw_input("请输入:"); numbers=['羊爸爸','羊妈妈','羊宝','牛宝'] while len(numbers)>0: number=numbers.pop() if name == number: flag=True break if flag == True: print 'Welcome Home '+name else: print name+'你不是权限,请离开'
For 循环语句
fruits = ['banana', 'apple', 'mango'] for fruit in fruits: # 第二个实例 print '当前水果 :', fruit print "Good bye!"