python學習筆記(二)

 

for i in range(1, 5):

    print(i)

else:

    print ('The for loop is over')

 

這段話的實際意思是:

int i=1;

for (i<5) {  

    system.out.println(i);

     i=i+1;

     }

 

system.out.println("the for loop is over.")

 

 

while True:

    s = input('Enter something : ')

    if s == 'quit':

        break

    print ('Length of the string is', len(s))

print ('Done' )

 

非常有意思的是,enter something冒號後面不會有空格,而length of string is後面會自動加上一個空格。

 

原發佈於:2010年03月19日 14:24:00

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章