2009年5月4日 星期一

For syntax

定義變數 fruit 為一個 List
fruit=['apple','orange','banana']
for f in fruit:
print(f)

增加一個空白行
print("")

for i in range(10):
print "Eat Fruit"

apple
orange
banana

Eat Fruit
Eat Fruit
Eat Fruit
Eat Fruit
Eat Fruit
Eat Fruit
Eat Fruit
Eat Fruit
Eat Fruit
Eat Fruit

沒有留言:

張貼留言