Discuss / Python / 作业

作业

Topic source

CHaoNan007

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

for...in 循环

L = ['Bart', 'Lisa', 'Adam']
for x in L:
    print('Hello,%s!' % x)

while循环

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

死循环

n=0
while n<3:
    print(n)
    n=n+1
    if n>1:
      n=n-1

  • 1

Reply