方法一:
# -*- coding: utf-8 -*-
# 請利用循環依次對list中的每個名字打印出Hello, xxx!
L = ['Bart', 'Lisa', 'Adam']
n = 0
while n < len(L):
print('hello,' + L[n] + '!')
n = n + 1
方法二:
# -*- coding: utf-8 -*-
# 請利用循環依次對list中的每個名字打印出Hello, xxx!
L = ['Bart', 'Lisa', 'Adam']
for x in L:
print('hello,' + x + '!')
