怎么用python邀请名人共进午餐?

老西儿最近开端学习python言语了,由于它是十分友爱的一门编程言语,并且关于网络爬虫等东西来说,也是最最根底的技能要求。对今后进行文明类的数据剖析,也十分有用。今日给我们共享的,就是如何用python来做嘉宾约请名单。

作业来历:《Python编程:从入门到实践》

作业3-4 嘉宾名单#3-4 list celebrities = ['Buffet','Lee Jiacheng','Wang Jianlin','Jack Ma']print(celebrities)作业3-5 嘉宾名单修正#3-5 list-editprint(celebrities[1] + " had another important pointment.") celebrities[1] = 'Elon Musk'print(celebrities)作业3-6 嘉宾名单增加人数#3-6 list-insertprint("\nA " + "bigger table has been found!")celebrities.insert(0,'Kaifu Li')celebrities.insert(2,'Mark Zuckburg')celebrities.append('Hu Lijing')print(celebrities)作业3-7 嘉宾名单人数约束#3-7 list-limitedprint("Sorry, the new table cannot be sent on time, only two celebrities can be invited.")rejected_celebrities = celebrities.pop(0)print("We are so sorry to inform you, " + rejected_celebrities + " is not allowed to come in.")rejected_celebrities = celebrities.pop(2)print("We are so sorry to inform you, " + rejected_celebrities + " is not allowed to come in.")rejected_celebrities = celebrities.pop(4)print("We are so sorry to inform you, " + rejected_celebrities + " is not allowed to come in.")print("We are so honored to inform you, " + celebrities[1] + " is allowed to come in.")print("We are so honored to inform you, " + celebrities[3] + " is allowed to come in.")del celebrities[0]print(celebrities)del celebrities[0]print(celebrities)input()

  • 发表于:
  • 原文链接https://kuaibao.qq.com/s/20180830A0I32N00?refer=cp_1026
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

扫码关注腾讯云开发者

领取腾讯云代金券