#邀请3个人一起共进晚餐name = ['jacky','kevin','bob']for i in name: print('Welcom %s join my dinner'% i )#bob不能参加a = 'bob'd_name = name.remove(a)print('%s is no going to jion my dinner' % a)#新增加一个人luccyname.append('luccy')for i in name: print('Welcom %s join my dinner'% i)#有更好的地方,又有3个人要加入我们(3个人加到最前面、中间、最后)print('We have better place,3 friends will jion us')name.insert(0,'user1')name.insert((len(name)//2),'user2')name.append('user3')for i in name: print('Welcom %s join my dinner'% i)#只能邀请2个人参加了,删除人员只留两个人,并通知他们print('We just have two firends can jion my dinner')num = len(name)for i in range(num): name2 = name.pop() print('Sorry %s' % name2) if num - i == 3: breakfor i in name: print('Welcom %s join my dinner'% i)#删除所有人,清空人员名单for i in range (len(name)): del name[0]print("%s list is empty" % name)