Discuss / Python / for in & while

for in & while

Topic source

VigorousTang

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

-- coding: utf-8 --

L = ['Bart', 'Lisa', 'Adam'] for i in range(3):#[0, 1, 2] print('Hello',L[i])

-- coding: utf-8 --

L = ['Bart', 'Lisa', 'Adam'] n = 3 while n > 0: print('Hello',L[-n]) n = n - 1


  • 1

Reply