Python基础入门例程16-NP16 发送offer(列表)
目录
描述
输入描述:
输出描述:
解答 :
说明:
描述
某公司在面试结束后,创建了一个依次包含字符串 'Allen' 和 'Tom' 的列表offer_list,作为通过面试的名单。
请你依次对列表中的名字发送类似 'Allen, you have passed our interview and will soon become a member of our company.' 的句子。
但由于Tom有了其他的选择,没有确认这个offer,HR选择了正好能够确认这个offer的Andy,所以请把列表offer_list中 'Tom' 的名字换成 'Andy' ,
再依次发送类似 'Andy, welcome to join us!' 的句子。
输入描述:
无
输出描述:
按题目描述进行输出即可。
Allen, you have passed our interview and will soon become a member of our company.
Tom, you have passed our interview and will soon become a member of our company.
Allen, welcome to join us!
Andy, welcome to join us!
解答 :
offer_list =['Allen','Tom']#列表创建
for i in offer_list:#循环操作
print('%s, you have passed our interview and will soon become a member of our company.' %i)
offer_list[1]='Andy'#列表索引
for j in offer_list:
print('%s, welcome to join us!' %j)
说明:
考查列表的操作:索引/创建
考查for循环的操作方法