Discuss / Python / 练习

练习

Topic source

枫澜-ye

#1 Created at ... [Delete] [Delete and Lock User]

for 循环:

L = ['Bart', 'Lisa', 'Adam'] for i in range(len(L)): print('Hello',L[i])

while 循环:

L = ['Bart', 'Lisa', 'Adam'] n = 0 while n < len(L): print('Hello',L[n]) n = n + 1

枫澜-ye

#2 Created at ... [Delete] [Delete and Lock User]

L = ['Bart', 'Lisa', 'Adam'] n = 0 while True: print('Hello',L[n]) n = n + 1 if n ==len(L): break


  • 1

Reply