实战01
print("“王者荣耀”的游戏角色:")
print("====坦克:====")
tank =["苏烈","刘邦","钟馗","张飞","牛魔","程咬金","白起","刘禅","庄周","项羽","廉颇","巨灵神","安禄山","猪八戒"]
for i in tank:
print(i,end = " ")
print("\n" + "====战士:====")
zhanshi = ["狂铁","裴擒虎","铠","孙悟空","哪吒","杨戬","橘右京","亚瑟","雅典娜","夏侯惇","关羽","吕布","韩信","老夫子",
"达摩","典韦","曹操","钟无艳","墨子","赵云","刑天","龙且"]
for i in zhanshi:
print(i,end = " ")
print("\n" + "====刺客:====")
cike = ["百里玄策","庞统","花木兰","阿轲(荆轲)","不知火舞","李白","娜可露露","兰陵王","露娜","韩信","宫本武",
"藏","盖聂","红拂"]
for i in cike:
print(i,end = " ")
print("\n" + "====法师:====")
fashi = ["杨玉环","弈星","女娲","周瑜","鬼谷子","羋月","干将","莫邪","东皇太一","大乔","诸葛亮","貂蝉","张良","安琪拉",
"不知火舞","姜子牙","武则天","王昭君","甄姬","扁鹊","高渐离","赢政","妲己","小乔"]
for i in fashi:
print(i,end = " ")
print("\n" + "====射手:====")
sheshou = ["公孙离","百里守约","后羿","刘备","黄忠","马可波罗","成吉思汗","虞姬","李元芳","艾琳","狄仁杰","鲁班七号",
"孙尚香"]
for i in sheshou:
print(i,end = " ")
print("\n" + "====辅助:====")
fuzhu = ["明世隐","梦奇","孙膑","太乙真人","蔡文姬"]
for i in fuzhu:
print(i,end = " ")
实战02
biaotou = ["车次"," ","出发站-到达站"," ","出发时间"," ","到达时间"," ","历时"]
checi = ["T40","T298","Z158","Z62"]
chufa_daoda = ["长春-北京","长春-北京","长春-北京","长春-北京"]
start_time = ["00:12","00:06","12:48","21:58"]
daoda_time = ["12:20","10:50","21:06","08:18"]
lishi = ["12:08","10:44","08:18","8:20"]
for i in biaotou:
print(i,end="")
print("\n")
print(checi[0],' ',chufa_daoda[0],' ',start_time[0],' ',daoda_time[0],' ',lishi[0],' ')
print(checi[1],' ',chufa_daoda[1],' ',start_time[1],' ',daoda_time[1],' ',lishi[2],' ')
print(checi[2],' ',chufa_daoda[2],' ',start_time[2],' ',daoda_time[2],' ',lishi[2],' ')
print(checi[3],' ',chufa_daoda[3],' ',start_time[3],' ',daoda_time[3],' ',lishi[3],' ')
chufa_chx = dict(zip(checi,chufa_daoda))
start_time_chx = dict(zip(checi,start_time))
daoda_time_chx = dict(zip(checi,daoda_time))
lishi_chx = dict(zip(checi,lishi))
acheci = input("请输入购买车次:")
goumairen = input("请输入乘车人(用逗号分隔):")
achufa = chufa_chx[acheci]
print("你已购买"+acheci+"次列车"+achufa+"开,请"+goumairen+"尽快换取纸质车票。【铁路客服】")
实战03
# 电视剧信息列表 每条信息包含收视率信息
TV_plays = [('《Give up,hold on to me》', 1.4),
('《The private dishes of the husbands》', 1.343),
('《My father-in-law will do martiaiarts》', 0.92),
('《North Canton still believe in love》', 0.862),
('《Impossible task》', 0.553),
('《Sparrow》', 0.411),
('《East of dream Avenue》', 0.164),
('《Theprodigal son of the new frontier town》', 0.259),
('《Distant distance》', 0.394),
('《Music legend》', 0.562),
]
# 使用内置sorted方法进行降序排序
TV_plays = sorted(TV_plays, key=lambda s: s[1], reverse=True)
print('电视剧的收视率排行榜:')
# 循环输出电视剧信息
for TV_play in TV_plays:
print(TV_play[0] + ' 收视率:' + str(TV_play[1]) + '%')
实战04
calling_plan = ["0分钟","50分钟","100分钟","300分钟","不限量"]
flow_plan = ["0M","500M","1G","5G","不限量"]
message_plan = ["0条","50条","100条"]
print("定制自己的手机套餐:")
#A.通话时长的选择
print("A.请设置通话时长:")
for index,calling in enumerate(calling_plan):
print(str(index+1)+"."+calling)
user_calling_plan = int(input("输入选择的通话时长编号:"))
while user_calling_plan > len(calling_plan) or user_calling_plan <= 0 :
user_calling_plan = int(input("请输入正确的套餐编号:"))
if 0 < user_calling_plan <= len(calling_plan):
break
numA = user_calling_plan
#B.流量的选择
print("B.请设置流量包:")
for index,flow in enumerate(flow_plan):
print(str(index+1)+"."+flow)
user_flow_plan = int(input("输入选择的流量包编号:"))
while user_flow_plan > len(flow_plan) or user_flow_plan <= 0 :
user_flow_plan = int(input("请输入正确的套餐编号:"))
if 0 < user_flow_plan <= len(flow_plan):
break
numB = user_flow_plan
#C.短信的选择
print("C.请设置短信条数:")
for index,message in enumerate(message_plan):
print(str(index+1)+"."+message)
user_message_plan = int(input("输入选择的短信条数编号:"))
while user_message_plan > len(message_plan) or user_message_plan <= 0 :
user_message_plan = int(input("请输入正确的套餐编号:"))
if 0 < user_message_plan <= len(message_plan):
break
numC = user_message_plan
#输出套餐结果
print("您的手机套餐定制成功:"
+"免费通话时长为"+calling_plan[numA-1]+"/月,"
+"流量为"+flow_plan[numB-1]+"/月,"
+"短信条数"+message_plan[numC-1]+"/月,"
)
标签:daoda,plan,time,print,Python4,message,user From: https://www.cnblogs.com/ron312/p/16739902.html