-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex_3.2.py
More file actions
47 lines (44 loc) · 2.54 KB
/
ex_3.2.py
File metadata and controls
47 lines (44 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# 练习列表各种操作
invite_persons = ['zhangyu','zhuozhiying','lihuoxiang','zhangwen','huanghaiting']
print("Dear " + invite_persons[0].title() + " ! I want to invite you to dinner.")
print("Dear " + invite_persons[1].title() + " ! I want to invite you to dinner.")
print("Dear " + invite_persons[2].title() + " ! I want to invite you to dinner.")
print("Dear " + invite_persons[3].title() + " ! I want to invite you to dinner.")
print("Dear " + invite_persons[4].title() + " ! I want to invite you to dinner.")
not_join_persons = 'zhangwen'
print(not_join_persons + " can't make an appointment")
invite_persons[-2] = 'zhangyi'
print("Dear " + invite_persons[0].title() + " ! I want to invite you to dinner.")
print("Dear " + invite_persons[1].title() + " ! I want to invite you to dinner.")
print("Dear " + invite_persons[2].title() + " ! I want to invite you to dinner.")
print("Dear " + invite_persons[3].title() + " ! I want to invite you to dinner.")
print("Dear " + invite_persons[4].title() + " ! I want to invite you to dinner.")
print("I found a bigger table !")
invite_persons.insert(0,'zhangtian')
print(invite_persons)
invite_persons.insert(3,'mijijun')
print(invite_persons)
invite_persons.append('ligang')
print(invite_persons)
print("Dear " + invite_persons[0].title() + " ! I want to invite you to dinner.")
print("Dear " + invite_persons[1].title() + " ! I want to invite you to dinner.")
print("Dear " + invite_persons[2].title() + " ! I want to invite you to dinner.")
print("Dear " + invite_persons[3].title() + " ! I want to invite you to dinner.")
print("Dear " + invite_persons[4].title() + " ! I want to invite you to dinner.")
print("Dear " + invite_persons[5].title() + " ! I want to invite you to dinner.")
print("Dear " + invite_persons[6].title() + " ! I want to invite you to dinner.")
print("Dear " + invite_persons[7].title() + " ! I want to invite you to dinner.")
print("I am very sorry, I can only invite two guests to dinner.")
pop_person_one = invite_persons.pop()
print(pop_person_one.title() + " I am very sorry!")
print(invite_persons.pop().title() + " I am very sorry!")
print(invite_persons.pop().title() + " I am very sorry!")
print(invite_persons.pop().title() + " I am very sorry!")
print(invite_persons.pop().title() + " I am very sorry!")
print(invite_persons.pop().title() + " I am very sorry!")
print(invite_persons)
print(invite_persons[0].title() + "I still want to invite you to dinner.")
print(invite_persons[1].title() + "I still want to invite you to dinner.")
del invite_persons[0]
invite_persons.remove('zhangyu')
print(invite_persons)