#16337256 肖鉴哲
#3-1
names
=
[
'xiaojz'
,
'yangxh'
,
'yangxy'
,
'caobb'
]
for
i
in
names:
print
(i)
#3-2
message
=
'hi ,'
for
i
in
names:
print
(message
+
i
+
'!'
)
#3-3
method
=
[
'car'
,
'train'
,
'airplane'
,
'foot'
]
for
i
in
method:
print
(
'i would like to travel by'
,i)
#3-4
my_guest
=
[
'spider-man'
,
'punisher'
,
'superman'
,
'batman'
]
for
i
in
my_guest:
print
(
'can you have dinner with me ,'
,i,
'?'
)
#3-5
ab_guest
=
'batman'
print
(ab_guest
+
' can
\'
t come !'
)
my_guest.remove(ab_guest)
my_guest.insert(
1
,
'moonknight'
)
for
i
in
my_guest:
print
(
'can you have dinner with me ,'
,i,
'?'
)
#3-6
print
(
'i have found a bigger table !'
)
my_guest.insert(
0
,
'Venom'
)
my_guest.insert(
2
,
'Iron Fist'
)
my_guest.append(
'captain american'
)
for
i
in
my_guest:
print
(
'can you have dinner with me ,'
,i,
'?'
)
#3-7
print
(
'i can only invite 2 people'
)
while
len
(my_guest)
>
2
:
i
=
my_guest.pop()
print
(
'i am so sorry'
,i)
#3-8
myPlace
=
[
'beijing'
,
'newYork'
,
'liyue'
,
'shanghai'
,
'lundun'
]
print
(myPlace)
print
(
sorted
(myPlace))
print
(myPlace)
print
(
sorted
(myPlace,
reverse
=
True
))
print
(myPlace)
myPlace.reverse()
print
(myPlace)
myPlace.reverse()
print
(myPlace)
myPlace.sort()
print
(myPlace)
myPlace.sort(
reverse
=
True
)
print
(myPlace)
#3-9
print
(
'i invite'
,
len
(my_guest),
'guest'
)
#3-11
#my_guest[len(my_guest)]='error'