首页 > 其他分享 >序列的应用

序列的应用

时间:2022-09-29 00:44:29浏览次数:64  
标签:item flow timer print num 应用 序列 message

import datetime
# 定义一个列表
mot = ["今天星期一: \n坚持下去不是因为我很坚强,而是因为我别无选择。",
       "今天星期二: \n含泪播种的人一定能笑着收获。",
       "今天星期三: \n做对的事情比把事情做对重要。",
       "今天星期四: \n命运给予我们的不是失望之酒,而是机会之杯。",
       "今天星期五: \n不要等到明天,明天太遥远,今天就行动。",
       "今天星期六: \n求知若饥,虚心若愚。",
       "今天星期日: \n成功将属于那些从不说“不可能”的人。"]
day=datetime.datetime.now().weekday()
print(mot[day])

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名人堂原有人员
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)

coffeename = ('蓝山','卡布奇诺','曼特宁','摩卡','麝香猫','哥伦比亚')
print("您好, 欢迎光临 ~ 伊米咖啡馆 ~\n\n我店有: \n")
for name in coffeename:
    print(name + "咖啡",end = " ")

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[4] = '拿铁'         # 将“麝香猫”替换为“拿铁”
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 = dict(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, '\n')
print( '选择C语言的学生有: ',C)
print('交集运算:',python & C)
print('并集运算:',python | C)
print('差集运算:',python - C)

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 + "/月")

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=" ")

TV = [
    ('《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 = sorted(TV, key=lambda s: s[1], reverse=True)
for tv in TV:
    print(tv[0] + '收视率:' + str(tv[1]) + '%')

title = ['车次 ', '出发站-到达站 ', '出发时间 ', '到达时间 ', '历时 ']
num = ['T40', 'T298', 'Z158', 'Z62']
place = ['长春-北京', '长春-北京', '长春-北京', '长春-北京']
start = ['00:12', '00:06', '12:48', '21:57']
final = ['12:20', '10:50', '21:06', '06:08']
time = ['12:08', '10:44', '08:18', '08:20']

print(title[0], ' ', title[1], ' ', title[2], ' ', title[3], ' ', title[4])
print(num[0], '  ', place[0], '     ', start[0], '    ', final[0], '   ', time[0])
print(num[1], ' ', place[1], '     ', start[1], '    ', final[1], '   ', time[1])
print(num[2], ' ', place[2], '     ', start[2], '    ', final[2], '   ', time[2])
print(num[3], '  ', place[3], '     ', start[3], '    ', final[3], '   ', time[3])

m = dict(zip(num, start))
n = dict(zip(num, place))

a = input('请输入要购买的车次:')
b = input('请输入乘车人(用逗号):')

aplace = n[a]
astart = m[a]

print(f'您已购{a}次列车 {aplace} {astart}开, 请{b}尽快换取纸质车票。【铁路客服】')

标签:item,flow,timer,print,num,应用,序列,message
From: https://www.cnblogs.com/whc123/p/16740078.html

相关文章

  • 序列的应用
    一、输出每日一帖    二、分两列显示2017~20118赛季NBA西部联盟前八名的球队   三、向NBA名人堂列表中追加2018年新进入的球星    四、使用二维......
  • 序列的应用
    实例1、输出每日一贴importdatetimemot=["今天星期一:\n坚持下去不是因为我很坚强,而是因为我别无选择。","今天星期二:\n含泪播种的人一定能笑着收获。","今天......
  • python实验报告第四章——序列的应用
                             python第四章——序列的应用一、实验目的和要求1、了解python中的序列结构2、学会使用列......
  • WPF应用图标更改,打包后安装依然显示原来的图标
    前因:更改项目的应用图标重新打包安装,发现桌面快捷方式图标依然没改,将该exe文件发送或者拷贝到桌面还是图标没改;但是,将exe文件拷贝到其它文件夹或者磁盘下,图标显示已经改了;......
  • 第四章 序列的应用
    (一)输出每日一贴1.代码:importdatetime   #导入日期时间类#定义一个列表mot=["今天星期一:\n坚持下去不是因为我坚强,而是因为我别无选择。",      "今天......
  • 25 bootstrap--v3--datetimepicker时间选择器--应用
    在模板中引用响应的文件比如:layout.html<linkrel="stylesheet"href="{%static'stark/plugins/datetimepicker/css/bootstrap-datetimepicker.css'%}"/><scripts......
  • PADS应用笔记:Layout时怎么隐藏飞线
    问题在布局时,地线太多影响看图,要怎么隐藏掉呢方法选中线后,右键设置查看网络,然后将线添加到查看列表,然后查看未布的线设置为无要重新显示的话:Ctrl+Alt+N打开网络显示......
  • PADS应用笔记:Layout里对齐和等间距方法
    问题怎么在layout布局时,对元件进对齐和等间距布局呢?方法关于对齐,鼠标选中多个元件后,邮件直接选对齐就好了,根据需求进行中心或者上下左右对齐关于等间距,有两个方法1.......
  • PADS应用笔记:Route拉线时线只显示细线
    问题拉线时,拉出来的线只显示一个细线,但线宽设置时候是设置成够长的原因PADS有显示最小线的设置,小于设置时就会显示一个细线,把最小显示线宽改大即可。......
  • Dubbo 泛化调用在vivo统一配置系统的应用
    作者:vivo互联网服务器团队-WangFei、LinYupanDubbo泛化调用特性可以在不依赖服务接口API包的场景中发起远程调用,这种特性特别适合框架集成和网关类应用开发。本文结合......