Discuss / Python / 两种循环

两种循环

Topic source

黑烏鴉

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

L = ['Bart', 'Lisa', 'Adam']

for name in L:

print(f'hello,{name}!')

L = ['Bart', 'Lisa', 'Adam']

i=len(L)

while i>0:

print('hello,',L[3-i]+'!')

i=i-1


  • 1

Reply