len
shoplist = ['apple', 'mango', 'carrot', 'banana']print('I have', len(shoplist), 'items to purchase.')
print('These items are:', end=' ')
for item in shoplist:
print(item, end=' ')
shoplist = ['apple', 'mango', 'carrot', 'banana']
print('I have', len(shoplist), 'items to purchase.')
print('These items are:', end=' ')
for item in len(shoplist):
print(shoplist, end=' ')
why改动后出错
for item in len(shoplist):
改为
for item in range(len(shoplist)):
页:
[1]