Python 入门教程 13 ---- Loops
第一节
1 介绍了另外一种循环while循环
2 while循环的结构如下
while condition:
statement
第二节
1 while循环的练习,写一个while循环,打印出1~10的平方数
fruits = ['banana', 'apple', 'orange', 'tomato', 'pear', 'grape']print 'You have...'for f in fruits: if f == 'tomato': print 'A tomato is not a fruit!' # (It actually is.) break print 'A', felse: print 'A fine selection of fruits!'