≈佐

—— 有恒则成。

统计

最新评论

使用列表

#Filename:using_list.py
#
This is shopping list

shoplist 
= ['apple','mango','carrot','banana']

print 'I have',len(shoplist),'items to purchase.'

print 'These items are:',
for item in shoplist:
    
print item,

print '\nI also have to buy rice.'
shoplist.append(
'rice')
print 'My shopping list is now',shoplist

print 'I will sort mylist now'
shoplist.sort()
print 'sorted shopping list is',shoplist

print 'The first item I will buy is',shoplist[0]
olditem 
= shoplist[0]
del shoplist[0]
print'I bought the',olditem
print 'My shopping list is now',shoplist

posted on 2009-06-20 00:34 ≈佐 阅读(89) 评论(0)  编辑  收藏 所属分类: Python知识


只有注册用户登录后才能发表评论。


网站导航: