Discuss / Python / 又来签到

又来签到

Topic source
#cycle

# for..(variable name)..in..(list name).. : cycle
# range(101) create a list of integer which from 0 to 100
# while ..(condition).. :  cycle(attention the condition will be decreasing until -1)

L = ['Bart','Lisa','Adam']
for name in L:
    print(name)
print('end of the for cycle\n')

counter=3
while counter>0 :
    counter=counter-1
    print(L[counter])
print('end of the while cycle\n')入代码

  • 1

Reply