赞
踩
- names = ["书涵","剑权","泽坤"]
-
- sayhi = ",你好呀~~"
-
- for name in names:
- print(name)
-
- print('----------')
-
- for name in names:
- print(name,sayhi)
- ================= RESTART: D:/program/Python/print_names.py =================
- 书涵
- 剑权
- 泽坤
- ----------
- 书涵 ,你好呀~~
- 剑权 ,你好呀~~
- 泽坤 ,你好呀~~
- transportation =[ "on foot","by Honda motorcycle",
- "by bike", "by Xiaohuang"]
-
- for t in transportation:
- print("Well, today I want to go outside",t)
- ================= RESTART: D:/program/Python/print_names.py =================
- Well, today I want to go outside on foot
- Well, today I want to go outside by Honda motorcycle
- Well, today I want to go outside by bike
- Well, today I want to go outside by Xiaohuang
- invitation = ["Hawking","Turning","Knuth"]
-
- def invite():
- for one in invitation:
- print("Hi,{},could you please go dinner with me tonight?".format(one))
-
- invite() #3-4
-
- deny = invitation[0]
- print("{} has just left us".format(deny))
-
- invitation[0] = "Zhengning Wang"
- invite() #3-5
-
- print("Good news. We have found a greater table.")
- invitation.insert(0,"Zhengdao Li")
- invitation.insert(2,"Xingbei Shu")
- invitation.append("Jiuzhang Zhao")
-
- invite() # 3-6
- print("I'm very sorry that I cannot invite all of you\
- , due to the new table's delivery.")
-
- for one in invitation[2:]:
- print(one,",I'm very sorry that I cannot invite all of you\
- , due to the new table's delivery.\n")
- invitation.pop(2)
-
- for one in invitation[:2]:
- print(one,", you are still invited. Can you come over?")
-
- del invitation[0]
- del invitation[0]
- invite()

- ================= RESTART: D:/program/Python/print_names.py =================
- Hi,Hawking,could you please go dinner with me tonight?
- Hi,Turning,could you please go dinner with me tonight?
- Hi,Knuth,could you please go dinner with me tonight?
- Hawking has just left us
- Hi,Zhengning Wang,could you please go dinner with me tonight?
- Hi,Turning,could you please go dinner with me tonight?
- Hi,Knuth,could you please go dinner with me tonight?
- Good news. We have found a greater table.
- Hi,Zhengdao Li,could you please go dinner with me tonight?
- Hi,Zhengning Wang,could you please go dinner with me tonight?
- Hi,Xingbei Shu,could you please go dinner with me tonight?
- Hi,Turning,could you please go dinner with me tonight?
- Hi,Knuth,could you please go dinner with me tonight?
- Hi,Jiuzhang Zhao,could you please go dinner with me tonight?
- I'm very sorry that I cannot invite all of you, due to the new table's delivery.
- Xingbei Shu ,I'm very sorry that I cannot invite all of you, due to the new table's delivery.
-
- Turning ,I'm very sorry that I cannot invite all of you, due to the new table's delivery.
-
- Knuth ,I'm very sorry that I cannot invite all of you, due to the new table's delivery.
-
- Jiuzhang Zhao ,I'm very sorry that I cannot invite all of you, due to the new table's delivery.
-
- Zhengdao Li , you are still invited. Can you come over?
- Zhengning Wang , you are still invited. Can you come over?

- places = ['Paris','New York','San Fransico','London','Silcon Valley']
-
- print("--------------------------")
- print(places)
- print("--------------------------")
- print(sorted(places))
- print("--------------------------")
- print(places)
- print("--------------------------")
- print(sorted(places,reverse=True))
- print("--------------------------")
- print(places)
- print("--------------------------")
- places.reverse()
- print(places)
- print("--------------------------")
- places.reverse()
- print(places)
- print("--------------------------")
- places.sort()
- print(places)
- print("--------------------------")
- places.sort(reverse=True)
- print(places)

- =============== RESTART: D:/program/Python/place_want_to_go.py ===============
- --------------------------
- ['Paris', 'New York', 'San Fransico', 'London', 'Silcon Valley']
- --------------------------
- ['London', 'New York', 'Paris', 'San Fransico', 'Silcon Valley']
- --------------------------
- ['Paris', 'New York', 'San Fransico', 'London', 'Silcon Valley']
- --------------------------
- ['Silcon Valley', 'San Fransico', 'Paris', 'New York', 'London']
- --------------------------
- ['Paris', 'New York', 'San Fransico', 'London', 'Silcon Valley']
- --------------------------
- ['Silcon Valley', 'London', 'San Fransico', 'New York', 'Paris']
- --------------------------
- ['Paris', 'New York', 'San Fransico', 'London', 'Silcon Valley']
- --------------------------
- ['London', 'New York', 'Paris', 'San Fransico', 'Silcon Valley']
- --------------------------
- ['Silcon Valley', 'San Fransico', 'Paris', 'New York', 'London']

太多啦,不打了。
有任何疑问请 email 280917855@qq.com 寻求帮助
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。