3-1 姓名:
namelist
=
[
'
name_one
',
'
name_two
',
'
name_three
'
]
for inx
in namelist:
print
(inx)
输出结果:
3-2 问候语:
namelist
=
[
'
name_one
',
'
name_two
',
'
name_three
'
]
for inx
in namelist:
print
(inx.
title
()
+
"
, I am glad to see you !
"
)
输出结果:
3-3 自己的列表:
mylist
=
[
'
plane
',
'
car
',
'
ship
'
]
for inx
in mylist:
print
(
"
I would like to own a
"
+
inx)
输出结果:
3-4 嘉宾名单:
guests
=
[
'
guest1
',
'
guest2
',
'
guest3
',
'
guest4
',
'
guest5
',
'
guest6
'
]
for inx
in guests
[:
4
]:
print
(
"
Dear
"
+
inx.
title
()
+
"
:
"
)
print
(
"
I hope to enjoy the dinner with you, please come to my house before 7:30 in April 1st
"
)
输出结果: