1.
以下執行結果是什麼?
i = 1
n = 3
while i < n:
print(i)
i = i + 1
2.
以下執行結果是什麼?
age = 32
while age > 18:
print('你有投票權')
3.
以下執行結果是什麼?
counter = 0
while counter <= 2:
print('Inside loop')
counter = counter + 1
else:
print('Inside else')
4.
以下執行結果是什麼?
i = 1
while i < 3:
print(i)
i += 1
5.
以下執行結果是什麼?
i = 1
while i <= 6:
print(i)
if i == 3:
break
i += 1
6.
以下執行結果是什麼?
i = 0
while i < 5:
i += 1
if i == 3:
continue
print(i)
7.
以下執行結果是什麼?
n = 5
while n > 0:
n -= 1
print(n)
if n == 2:
break
else:
print('Loop done.')