作为基础练习吧。列表list,元组tuple,集合set,字符串string等等,显示,增删,合并。。。
![](https://img.laitimes.com/img/9ZDMuAjOiMmIsIjOiQnIsIiZpdmLlR2bjlHcvN2LcNXZnFWbp9CXt92YuM3ZvxmYuNmLu9Wbt92Yvw1LcpDc0RHaiojIsJye.gif)
![](https://img.laitimes.com/img/9ZDMuAjOiMmIsIjOiQnIsIiZpdmLlR2bjlHcvN2LcNXZnFWbp9CXt92YuM3ZvxmYuNmLu9Wbt92Yvw1LcpDc0RHaiojIsJye.gif)
输出:
c:\webpy\webpy\scripts\python.exe c:/pycode/pycode.py
i have 4 items to purchase.
these items are:
apple mango carrot banana
i also have to buy rice.
my shopping list is now ['apple', 'mango', 'carrot', 'banana', 'rice']
i will sort my list now
sorted shopping list is ['apple', 'banana', 'carrot', 'mango', 'rice']
the first item i will buy is apple
i bought the apple
my shopping list is ['banana', 'carrot', 'mango', 'rice']
number of animals in the zoo is 3
number of cages in the new zoo is 3
all animals in new zoo are ('monkey', 'camel', ('python', 'elephant', 'penguin'))
animals brought from old zoo are ('python', 'elephant', 'penguin')
last animal brought from old zoo is penguin
number of animal in the new zoo is 5
there are 3 contacts in the address-book.
item 0 is banana
item 3 is rice
item -2 is mango
item 1 to 3 is ['carrot', 'mango']
item start to end is ['banana', 'carrot', 'mango', 'rice']
item step 2 is ['banana', 'mango']
true
false
set(['brazil', 'china', 'india'])
simple assignment
shoplist is ['carrot', 'mango', 'rice']
mylist is ['carrot', 'mango', 'rice']
copy by making a full slice
mylist is ['mango', 'rice']
yes, the string starts with swa
yes, the string contains the string "a"
yes, the string contains the string "war"
brazil_*_russia_*_india_*_china
process finished with exit code 0