首页 > 其他分享 >13 刘欣晨 2022.9.22

13 刘欣晨 2022.9.22

时间:2022-09-29 14:46:00浏览次数:61  
标签:13 num 22 刘欣晨 flow timer 项目名称 train print

实验 一  项目名称:      输出每日一贴                       

import datetime

mot=["今天星期一:\n坚持下去不是因为我很坚强,而是因为我别无选择。",

     "今天星期二:\n含泪播种的人一定能笑着收获。",

     "今天星期三:\n做对的事情比把事情做对更重要。",

     "今天星期四:\n命运给予我们的不是失望之酒,而是机会之杯。",

     "今天星期五:\n不要等到明天,明天太遥远,今天就行动。",

     "今天星期六:\n求知若饥,虚心若愚。",

     "今天星期日:\n成功将属于那些从不说“不可能”的人。",]

day=datetime.datetime.now().weekday()

print(mot[day])   

 

 

实验 二  项目名称:分两列显示2017~2018赛季NBA西部联盟前八名的球队

print("2017~2018赛季NBA西部联盟前八名\n")

team = ["火箭","勇士","开拓者","雷霆","爵士","鹈鹕","马刺","森林狼"]

for index,item in enumerate(team):

if index%2 == 0:

 print(item +"\t\t", end='')

else:

print(item +"\n")

 

 

实验 三  项目名称:向NBA名人堂列表中追加2018年新进入的球星

oldlist = ["迈克尔·乔丹","卡里姆·阿布杜尔·贾巴尔","哈基姆·奥拉朱旺","查尔斯·巴克利","姚明"]

newlist = ["贾森·基德","史蒂夫·纳什","格兰特·希尔"]

oldlist.extend(newlist)

print(oldlist) 

 

实验 四  项目名称:使用二维列表输出不同版式的古诗

str1 = "千山鸟飞尽"

str2 = "万径人踪灭"

str3 = "孤舟蓑笠翁"

str4 = "独钓寒江雪"

verse = [list(str1),list(str2),list(str3),list(str4)]

print("\n-- 横版 --\n")

for i in range(4):

    for j in range(5):

        if j == 4:

            print(verse[i][j])

        else:

            print(verse[i][j],end='')

verse.reverse()

print("\n-- 竖版 --\n")

for i in range(5):

    for j in range(4):

        if j == 3:

            print(verse[j][i])

        else:

            print(verse[j][i],end='') 

 

 

 

实验 五  项目名称:使用元组保存咖啡馆里提供的咖啡名称

coffeename = ('蓝山','卡布奇诺','曼特宁','麝香猫','摩卡','哥伦比亚')

print(coffeename)

 

实验 六  项目名称:使用for循环列出咖啡馆里提供的咖啡名称

coffeename = ('蓝山','卡布奇诺','曼特宁','麝香猫','摩卡','哥伦比亚')

print("您好,欢迎光临~伊米咖啡馆~\n\n我店有:\n")

for name in coffeename:

print(name+"咖啡",end = " ")

 

 

 

实验 七  项目名称:分两列显示2017~2018赛季NBA西部联盟前八名的球队

print("2017~2018赛季NBA西部联盟前八名\n")

team = ["火箭","勇士","开拓者","雷霆","爵士","鹈鹕","马刺","森林狼"]

for index,item in enumerate(team):

if index%2 == 0:

 print(item +"\t\t", end='')

else:

print(item +"\n")

 

 

实验 八  项目名称:将麝香猫咖啡替换成拿铁咖啡

coffeename = ('蓝山','卡布奇诺','曼特宁','摩卡','麝香猫','哥伦比亚')

coffeename = ('蓝山','卡布奇诺','曼特宁','摩卡','拿铁','哥伦比亚')

print("新元组",coffeename)

 

 

实验 九  项目名称:创建一个保存女神星座的字典

name = ['绮梦','冷伊一','香凝','黛兰']

sign = ['水瓶座','射手座','双鱼座','双子座']

dictionary = dict(zip(name,sign))

print(dictionary)

 

 

实验 十  项目名称:根据星座测试性格特点

name = ['绮梦','冷伊一','香凝','黛兰']

sign_person = ['水瓶座','射手座','双鱼座','双子座']

person_dict = dict(zip(name,sign_person))

sign_all =['白羊座','金牛座','双子座','巨蟹座','狮子座','处女座','天秤座','天蝎座','射手座','魔蝎座','水瓶座','双鱼座']

nature = ['有一种让人看见就觉得开心的感觉,阳光、乐观、坚强,性格直来直去,就是有点小脾气。',

          '很保守,喜欢稳定,一旦有什么心动就会觉得心里不踏实,性格比较慢热,是个理财高手。',

          '喜欢追求新鲜感,有点小聪明,耐心不够,因你的可爱性格会让很多人喜欢和你做朋友。',

          '情绪容易敏感,缺乏安全感,做事情有坚持到底的毅力,为人重情重义,对朋友和家人特别忠实。',

          '有着远大的理想,总想靠自己的努力成为人上人,总是期待被仰慕被崇拜的感觉。',

          '坚持追求自己的完美主义者。',

          '追求平等、和谐,交际能力强,因此朋友较多。最大的缺点就是面对选择总是犹豫不决。',

          '精力旺盛,占有欲强,对于生活很有目标,不达目的誓不罢休,复仇心重。',

          '崇尚自由,勇敢、果断、独立,身上有一股勇往直前的劲儿,只要想做,就能做。',

          '是最有耐心的,做事小心。做事脚踏实地,比较固执,不达目的不罢休,而且非常勤奋。',

          '人很聪明,最大的特点就是创新,追求独一无二的生活,个人主义色彩很浓重的星座。',

          '集所有星座的优缺点于一身,最大的优点是有一颗善良的心,愿意帮助别人。']

sign_dict = dict(zip(sign_all,nature))

print("【香凝】的星座是",person_dict.get("香凝"))

print("\n 她的性格特点是:\n\n",sign_dict.get(person_dict.get("香凝")))

 

 实验 十一  项目名称:应用字典推导式实现根据名字和星座创建一个字典

name = ['绮梦','冷伊一','香凝','黛兰']

sign = ['水瓶','射手','双鱼','双子']

dictionary = {i:j+'座' for i,j in zip(name,sign)}

print(dictionary)

 

实验 十二  项目名称:创建保存学生选课信息的集合

python = {'绮梦','冷伊一','香凝','黛兰'}

c = {'冷伊一','零语','梓轩','圣博'}

print('选择python语言的学生有:',python,'\n')

print('选择c语言的学生有:',c)

 

 

实验 十三  项目名称:学生更改选学课程

python = set(['绮梦','冷伊一','香凝','梓轩'])

python.add('零语')

c = set(['冷伊一','零语','梓轩','圣博'])

c.remove('零语')

print('选择python语言的学生有:',python,'\n')

print('选择c语言的学生有:',c)

 

 

实验 十四  项目名称:对选课集合进行交集、并集和差集运算

python = set(['绮梦','冷伊一','香凝','梓轩'])

c = set(['冷伊一','零语','梓轩','圣博'])

print('选择python语言的学生有:',python)

print('选择c语言的学生有:',c)

print('交集运算:',python & c)

print('并集运算:',python | c)

print('差集运算:',python - c)

 

 

实战 一  项目名称:输出“王者荣耀”的游戏角色

print("”王者荣耀“游戏角色")

print("====坦克====")

str1 = ["苏烈","刘邦","钟馗","张飞","牛魔","程咬金","白起","刘禅","庄周","项羽","廉颇","巨灵神","安禄山","猪八戒"]

for i in str1:

    print(i,end=" ")

print("\n"+"====战士====")

str2 = ['狂铁','裴擒虎','铠','孙悟空','哪吒','杨戬','橘右京','亚瑟','雅典娜','夏侯惇','关羽','吕布','韩信','老夫子','达摩','典韦','曹操','钟无艳','墨子','赵云','刑天','龙且']

for i in str2:

    print(i,end=" ")

print("\n"+"====刺客====")

str3 = ['百里守约','庞统','花木兰','阿轲(荆轲)','不知火舞','李白','娜可露露','兰陵王','露娜','韩信','宫本武藏','盖聂','红拂']

for i in str3:

    print(i,end=" ")

print("\n"+"====法师====")

str4 = ['杨玉环','弈星','女娲','周瑜','鬼谷子','芈月','干将莫邪','东皇太一','大乔','诸葛亮','貂蝉','张良','安琪拉','不知火舞','姜子牙','武则天','王昭君','甄姬','扁鹊','高渐离','嬴政','妲己','小乔']

for i in str4:

    print(i,end=" ")

print("\n"+"====射手====")

str5 = ['公孙离','百里守约','后羿','刘备','黄忠','马可波罗','成吉思汗','虞姬','李元芳','艾琳','狄仁杰','鲁班七号','孙尚香']

for i in str5:

    print(i,end=" ")

print("\n"+"====辅助====")

str6 = ['明世隐','梦奇','孙膑','太乙真人','蔡文姬']

for i in str6:

print(i,end=" ")

 

 

实战 二 项目名称:模拟火车订票系统

str1 = ['车次','出发站-到达站','出发时间','到达时间','历时']

train_numbers = ['T40','T298','Z158','Z62']

train_place = ['长春-北京','长春-北京','长春-北京','长春-北京']

train_outTime = ['00:12','00:06','12:48','21:58']

train_arriveTime = ['12:20','10:50','21:06','06:08']

train_sumTime = ['12:08','10:44','08:18','8:20']

print(str1[0], str1[1], str1[2], str1[3], str1[4])

print(train_numbers[0],' ', train_place[0],' ',  train_outTime[0],' ',   train_arriveTime[0],' ', train_sumTime[0])

print(train_numbers[1] ,' ',train_place[1],' ',  train_outTime[1],' ',   train_arriveTime[1],' ', train_sumTime[1])

print(train_numbers[2] ,' ',train_place[2],' ',  train_outTime[2],' ',   train_arriveTime[2],' ', train_sumTime[2])

print(train_numbers[3],' ', train_place[3],' ',  train_outTime[3],' ',   train_arriveTime[3],' ', train_sumTime[3])

number = input("请输入要购买的车次:")

name = input("请输入乘车人(用半角逗号分隔开):")

if number == train_numbers[0]:

    print("您已购"+str(number)+"次列车"+train_place[0]+"开,请"+name+"尽快换取纸质车票。【铁路服务】")

elif number == train_numbers[1]:

    print("您已购"+str(number)+"次列车"+train_place[1]+"开,请"+name+"尽快换取纸质车票。【铁路服务】")

elif number == train_numbers[2]:

    print("您已购"+str(number)+"次列车"+train_place[2]+"开,请"+name+"尽快换取纸质车票。【铁路服务】")

else:

    print("您已购"+str(number)+"次列车"+train_place[3]+"开,请"+name+"尽快换取纸质车票。【铁路服务】")

 

 

实战 三 项目名称:电视剧的收视率排行榜

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),

('《The prodigal son of the new frontier town》',0.259),

('《Distant distance》',0.394),

('《Music legend》',0.562),

]

TV_plays = sorted(TV_plays, key = lambda s:s[1], reverse = True)

for TV_play in TV_plays:

print(TV_play[0]+"收视率:"+str(TV_play[1])+"%")

 

 

 

 

print("定制自己的手机套餐")

timer = ['0分钟','50分钟','100分钟','300分钟','不限量']

flow = ['0M','500M','1G','不限量']

message = ['0条','50条','100条']

print("A.请设置通话时长:")

for index,item in enumerate(timer):

print(str(index+1)+'.',item)

charges_num = input("请输入选择的通话时长编号:")

if charges_num == "1":

timer_c = timer[0]

if charges_num =="2":

timer_c = timer[1]

if charges_num =="3":

timer_c = timer[2]

if charges_num =="4":

timer_c = timer[3]

if charges_num =="5":

timer_c = timer[4]

print("B.请设置流量包:")

for index,item in enumerate(flow):

print(str(index + 1)+'.',item)

flow_num = input("请输入选择的流量包编号:")

if flow_num == "1":

flow_c = flow[0]

if flow_num == "2":

flow_c = flow[1]

if flow_num == "3":

flow_c = flow[2]

if flow_num == "4":

flow_c = flow[3]

print("C.请设置短信条数:")

for index,item in enumerate(message):

print(str(index + 1)+'.',item)

message_num = input("请输入选择的短信条数编号:")

if message_num == "1":

message_c = message[0]

if message_num == "2":

message_c = message[1]

if message_num == "3":

message_c = message[2]

print("您的手机套餐定制成功:免费通话时长为"+timer_c + "/月,流量为"+flow_c + "/月,短信条数" + message_c + "/月")

 

标签:13,num,22,刘欣晨,flow,timer,项目名称,train,print
From: https://www.cnblogs.com/L13538196467/p/16741494.html

相关文章