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