Discuss / Python / for循环与while循环

for循环与while循环

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(L[2-i])

i=i-1

黑烏鴉

#2 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(L[3-i])

i=i-1

黑烏鴉

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

错的,不用管


  • 1

Reply