老西儿最近开端学习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()
领取专属 10元无门槛券
私享最新 技术干货