首页 > 代码库 > ex34.py

ex34.py

 1 # -*- coding:GBK -*-
 2 animals = ["", "python", "孔雀", "袋鼠", "鲸鱼", "鸭嘴兽"]
 3 
 4 place1 = animals[0]
 5 print ("the place1 animal is %r." % place1)
 6 
 7 no3 = animals[3]
 8 print ("the no3 animal is %r." % no3)
 9 
10 no1 = animals[0]
11 print ("the no1 animal is %r." % no1)
12 
13 place3 = animals[2]
14 print ("the place3 animal is %r." % place3)
15 
16 no5 = animals[5]
17 print ("the no5 animal is %r." % no5)
18 
19 place6 = animals[5]
20 print ("the place6 animal is %r." % place6)
21 
22 place4 = animals[3]
23 print ("the place4 animal is %r." % place4)
24 
25 #应该看到的结果
26 ‘‘‘the place1 animal is ‘熊‘.
27 the no3 animal is ‘袋鼠‘.
28 the no1 animal is ‘熊‘.
29 the place3 animal is ‘孔雀‘.
30 the no5 animal is ‘鸭嘴兽‘.
31 the place6 animal is ‘鸭嘴兽‘.
32 the place4 animal is ‘袋鼠‘.‘‘‘

 

ex34.py